Invalid state here was detected based on the parent token being in
JSON_STARTED state, but to be clearer for static analyzers, also check
explicitly that depth is not 0.
Signed-off-by: Jouni Malinen <j@w1.fi>
case ']': /* end array */
case '}': /* end object */
if (!curr_token || !curr_token->parent ||
- curr_token->parent->state != JSON_STARTED) {
+ curr_token->parent->state != JSON_STARTED ||
+ depth == 0) {
wpa_printf(MSG_DEBUG,
"JSON: Invalid state for end array/object");
goto fail;