json: init value to ->cur instead of NULL

Or else we end up with a return value of ->cur - NULL, which might look
lik a positive result and cause a crash later on.

Fixes #641
This commit is contained in:
Wim Taymans 2021-01-29 09:18:59 +01:00
parent c64bf36e8e
commit 6370d75efd

View file

@ -66,7 +66,7 @@ static inline int spa_json_next(struct spa_json * iter, const char **value)
int utf8_remain = 0;
enum { __NONE, __STRUCT, __BARE, __STRING, __UTF8, __ESC, __COMMENT };
*value = NULL;
*value = iter->cur;
for (; iter->cur < iter->end; iter->cur++) {
unsigned char cur = (unsigned char)*iter->cur;
again: