From f76bcab82520b9562da92f25db42b5a99fee82f5 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Thu, 6 Feb 2014 12:25:59 -0800 Subject: [PATCH] Detect misplaced comma within hash --- jsonpull.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/jsonpull.c b/jsonpull.c index 53a6354a..2dea6473 100644 --- a/jsonpull.c +++ b/jsonpull.c @@ -229,6 +229,13 @@ again: return NULL; } + if (current->parent->type == JSON_HASH) { + if (current->parent->length == 0 || current->parent->values[current->parent->length - 1] == NULL) { + *error = "Found comma in hash without a hash value"; + return NULL; + } + } + current = current->parent; current_is = ','; goto again;