diff options
Diffstat (limited to 'src/jplist.c')
| -rw-r--r-- | src/jplist.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/jplist.c b/src/jplist.c index c2d3ae3..7264da2 100644 --- a/src/jplist.c +++ b/src/jplist.c | |||
| @@ -671,12 +671,16 @@ static plist_t parse_object(const char* js, jsmntok_info_t* ti, int* index) | |||
| 671 | PLIST_JSON_ERR("%s: token type != JSMN_OBJECT\n", __func__); | 671 | PLIST_JSON_ERR("%s: token type != JSMN_OBJECT\n", __func__); |
| 672 | return NULL; | 672 | return NULL; |
| 673 | } | 673 | } |
| 674 | plist_t obj = plist_new_dict(); | ||
| 675 | int num_tokens = ti->tokens[*index].size; | 674 | int num_tokens = ti->tokens[*index].size; |
| 676 | int num; | 675 | int num; |
| 677 | int j = (*index)+1; | 676 | int j = (*index)+1; |
| 677 | if (num_tokens % 2 != 0) { | ||
| 678 | PLIST_JSON_ERR("%s: number of children must be even\n", __func__); | ||
| 679 | return NULL; | ||
| 680 | } | ||
| 681 | plist_t obj = plist_new_dict(); | ||
| 678 | for (num = 0; num < num_tokens; num++) { | 682 | for (num = 0; num < num_tokens; num++) { |
| 679 | if (j >= ti->count) { | 683 | if (j+1 >= ti->count) { |
| 680 | PLIST_JSON_ERR("%s: token index out of valid range\n", __func__); | 684 | PLIST_JSON_ERR("%s: token index out of valid range\n", __func__); |
| 681 | plist_free(obj); | 685 | plist_free(obj); |
| 682 | return NULL; | 686 | return NULL; |
