mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
json: improve unicode parsing
Make sure don't overread the strings. Don't use sscanf but use a custom hex read function. Fixes #2340
This commit is contained in:
parent
f641e4ecb3
commit
92e2b7dd0d
2 changed files with 31 additions and 9 deletions
|
|
@ -179,6 +179,9 @@ PWTEST(json_encode)
|
|||
strcpy(dst, "\"\\u03b2a\"");
|
||||
pwtest_int_eq(spa_json_parse_stringn(dst, sizeof(dst), result, sizeof(result)), 1);
|
||||
pwtest_str_eq(result, "\316\262a");
|
||||
strcpy(dst, "\"\\u 03b2a \"");
|
||||
pwtest_int_eq(spa_json_parse_stringn(dst, sizeof(dst), result, sizeof(result)), 1);
|
||||
pwtest_str_eq(result, "u 03b2a ");
|
||||
|
||||
return PWTEST_PASS;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue