mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
json: allocate one extra byte for the \0
This commit is contained in:
parent
f891324e25
commit
579e8a4ea6
4 changed files with 6 additions and 5 deletions
|
|
@ -168,7 +168,7 @@ static int parse_modules(struct data *d, const char *str)
|
|||
if (spa_json_is_container(aval, alen))
|
||||
alen = spa_json_container_len(&it[2], aval, alen);
|
||||
|
||||
args = malloc(alen);
|
||||
args = malloc(alen + 1);
|
||||
spa_json_parse_string(aval, alen, args);
|
||||
} else if (strcmp(arg, "flags") == 0) {
|
||||
flags = strndup(aval, alen);
|
||||
|
|
@ -249,7 +249,8 @@ static int parse_objects(struct data *d, const char *str)
|
|||
if (strcmp(arg, "args") == 0) {
|
||||
if (spa_json_is_container(aval, alen))
|
||||
alen = spa_json_container_len(&it[2], aval, alen);
|
||||
args = malloc(alen);
|
||||
|
||||
args = malloc(alen + 1);
|
||||
spa_json_parse_string(aval, alen, args);
|
||||
} else if (strcmp(arg, "flags") == 0) {
|
||||
flags = strndup(aval, alen);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue