The problem was caused by the fact that req->field_name was reset in the
beginning of oauth2_parse_json(), which is continuously called when more payload
can be read from the input stream. This leads to corruption of the parser state
machine each time parsing is continued.
To fix this issue, the field_name is now reset only when the parsing commences.
req->parser = json_parser_init(req->is);
req->json_parsed_cb = oauth2_introspect_continue;
req->io = io_add_istream(req->is, oauth2_parse_json, req);
+ req->field_name = NULL;
oauth2_parse_json(req);
}
}
req->parser = json_parser_init(req->is);
req->json_parsed_cb = oauth2_refresh_continue;
req->io = io_add_istream(req->is, oauth2_parse_json, req);
+ req->field_name = NULL;
oauth2_parse_json(req);
}
}
req->parser = json_parser_init(req->is);
req->json_parsed_cb = oauth2_token_validate_continue;
req->io = io_add_istream(req->is, oauth2_parse_json, req);
+ req->field_name = NULL;
oauth2_parse_json(req);
}
}
const char *token, *error;
int ret;
- req->field_name = NULL;
-
while((ret = json_parse_next(req->parser, &type, &token)) > 0) {
if (req->field_name == NULL) {
if (type != JSON_TYPE_OBJECT_KEY) break;