mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
json: handle incomplete strings
If we run to the end of the string and the string is not closed, assume it closed.
This commit is contained in:
parent
799bc13c85
commit
d09cb1f05b
2 changed files with 14 additions and 2 deletions
|
|
@ -166,7 +166,7 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
|
|||
}
|
||||
if (iter->depth != 0)
|
||||
return -1;
|
||||
if (iter->state == __BARE) {
|
||||
if (iter->state != __STRUCT) {
|
||||
iter->state = __STRUCT;
|
||||
return iter->cur - *value;
|
||||
}
|
||||
|
|
@ -290,7 +290,7 @@ static inline int spa_json_parse_string(const char *val, int len, char *result)
|
|||
result[len] = '\0';
|
||||
return 1;
|
||||
}
|
||||
for (p = val+1; p < val + len-1; p++) {
|
||||
for (p = val+1; p < val + len; p++) {
|
||||
if (*p == '\\') {
|
||||
p++;
|
||||
if (*p == 'n')
|
||||
|
|
@ -305,6 +305,8 @@ static inline int spa_json_parse_string(const char *val, int len, char *result)
|
|||
*result++ = '\f';
|
||||
else
|
||||
*result++ = *p;
|
||||
} else if (*p == '\"') {
|
||||
break;
|
||||
} else
|
||||
*result++ = *p;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue