mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
spa: json: allow only ascii in bare values
Control characters probably are an error. We also are not validating any utf8 here, so disallow bare utf8 too --- one likely should use strings for such content anyway as spaces are not allowed otherwise.
This commit is contained in:
parent
e63e8b8a37
commit
921c8b99db
2 changed files with 23 additions and 1 deletions
|
|
@ -137,12 +137,16 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
|
|||
/* disallow bare escape */
|
||||
goto error;
|
||||
default:
|
||||
/* allow bare ascii */
|
||||
if (!(cur >= 32 && cur <= 126))
|
||||
goto error;
|
||||
*value = iter->cur;
|
||||
iter->state = __BARE | flag;
|
||||
}
|
||||
continue;
|
||||
case __BARE:
|
||||
switch (cur) {
|
||||
case '\0':
|
||||
case '\t': case ' ': case '\r': case '\n':
|
||||
case '"': case '#':
|
||||
case ':': case ',': case '=': case ']': case '}':
|
||||
|
|
@ -153,8 +157,12 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
|
|||
case '\\':
|
||||
/* disallow bare escape */
|
||||
goto error;
|
||||
default:
|
||||
/* allow bare ascii */
|
||||
if (cur >= 32 && cur <= 126)
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
goto error;
|
||||
case __STRING:
|
||||
switch (cur) {
|
||||
case '\\':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue