json: spa_json_get_string() writes up to len chars or fail

This commit is contained in:
Wim Taymans 2022-01-04 10:42:32 +01:00
parent 68b31d37d9
commit c46113faa3
17 changed files with 26 additions and 26 deletions

View file

@ -393,8 +393,8 @@ static int parse_spa_libs(struct pw_context *context, char *str)
return -EINVAL;
}
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
if (spa_json_get_string(&it[1], value, sizeof(value)-1) > 0) {
while (spa_json_get_string(&it[1], key, sizeof(key)) > 0) {
if (spa_json_get_string(&it[1], value, sizeof(value)) > 0) {
pw_context_add_spa_lib(context, key, value);
count++;
}
@ -445,7 +445,7 @@ static int parse_modules(struct pw_context *context, char *str)
while (spa_json_enter_object(&it[1], &it[2]) > 0) {
char *name = NULL, *args = NULL, *flags = NULL;
while (spa_json_get_string(&it[2], key, sizeof(key)-1) > 0) {
while (spa_json_get_string(&it[2], key, sizeof(key)) > 0) {
const char *val;
int len;
@ -529,7 +529,7 @@ static int parse_objects(struct pw_context *context, char *str)
while (spa_json_enter_object(&it[1], &it[2]) > 0) {
char *factory = NULL, *args = NULL, *flags = NULL;
while (spa_json_get_string(&it[2], key, sizeof(key)-1) > 0) {
while (spa_json_get_string(&it[2], key, sizeof(key)) > 0) {
const char *val;
int len;
@ -616,7 +616,7 @@ static int parse_exec(struct pw_context *context, char *str)
while (spa_json_enter_object(&it[1], &it[2]) > 0) {
char *path = NULL, *args = NULL;
while (spa_json_get_string(&it[2], key, sizeof(key)-1) > 0) {
while (spa_json_get_string(&it[2], key, sizeof(key)) > 0) {
const char *val;
int len;