aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2015-03-06 14:43:43 +0100
committerPascal Quantin <pascal.quantin@gmail.com>2015-03-06 19:48:00 +0000
commit5da569345dacc2e053b44ce72a84ad4ccabaf2e2 (patch)
tree0e6e48cd701cc1b6da6fed7022d1b37cba644020 /wsutil
parent9ca58d7807a2a3314cdd0d55cba01c4b0f40f57c (diff)
jsmn: bugfix in jsmn_parse() (found by clang).
Change-Id: Id5a9888a3e17c861a9de06343bd99ec0c4aacdce Reviewed-on: https://code.wireshark.org/review/7555 Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Pascal Quantin <pascal.quantin@gmail.com>
Diffstat (limited to 'wsutil')
-rw-r--r--wsutil/jsmn.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/wsutil/jsmn.c b/wsutil/jsmn.c
index fdfd3a74cc..79cf363fff 100644
--- a/wsutil/jsmn.c
+++ b/wsutil/jsmn.c
@@ -317,10 +317,12 @@ int jsmn_parse(jsmn_parser *parser, const char *js, size_t len,
}
}
- for (i = parser->toknext - 1; i >= 0; i--) {
- /* Unmatched opened object or array */
- if (tokens[i].start != -1 && tokens[i].end == -1) {
- return JSMN_ERROR_PART;
+ if (tokens != NULL) {
+ for (i = parser->toknext - 1; i >= 0; i--) {
+ /* Unmatched opened object or array */
+ if (tokens[i].start != -1 && tokens[i].end == -1) {
+ return JSMN_ERROR_PART;
+ }
}
}