json: allocate one extra byte for the \0

This commit is contained in:
Wim Taymans 2021-01-19 16:56:55 +01:00
parent f891324e25
commit 579e8a4ea6
4 changed files with 6 additions and 5 deletions

View file

@ -71,7 +71,7 @@ static void expect_string(struct spa_json *it, const char *str)
char *s;
spa_assert((len = spa_json_next(it, &value)) > 0);
check_type(TYPE_STRING, value, len);
s = alloca(len);
s = alloca(len+1);
spa_json_parse_string(value, len, s);
spa_assert(strcmp(s, str) == 0);
}