diff options
author | Markus Armbruster <armbru@redhat.com> | 2015-11-25 22:23:22 +0100 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-11-26 09:17:57 +0100 |
commit | 4f2d31fbc0bfdf41feea7d1be49f4f7ffa005534 (patch) | |
tree | 6af228fd95b19f09a45fe5972b1858cd53ba3353 | |
parent | 3a81a10179b702e031d8f84438193d83a64b4122 (diff) |
qjson: Apply nesting limit more sanely
The nesting limit from commit 29c75dd "json-streamer: limit the
maximum recursion depth and maximum token count" applies separately to
braces and brackets. This makes no sense. Apply it to their sum,
because that's actually a measure of recursion depth.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-Id: <1448486613-17634-2-git-send-email-armbru@redhat.com>
-rw-r--r-- | qobject/json-streamer.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/qobject/json-streamer.c b/qobject/json-streamer.c index 1b2f9b1d10..dced2c77a1 100644 --- a/qobject/json-streamer.c +++ b/qobject/json-streamer.c @@ -64,8 +64,7 @@ static void json_message_process_token(JSONLexer *lexer, QString *token, JSONTok parser->bracket_count == 0)) { goto out_emit; } else if (parser->token_size > MAX_TOKEN_SIZE || - parser->bracket_count > MAX_NESTING || - parser->brace_count > MAX_NESTING) { + parser->bracket_count + parser->brace_count > MAX_NESTING) { /* Security consideration, we limit total memory allocated per object * and the maximum recursion depth that a message can force. */ |