Skip to content

Commit

Permalink
Merge branch 'bugfix/jsonparse_strcmp_value' into 'master'
Browse files Browse the repository at this point in the history
fix(json): The value jsonparse_strcmp_value returns is incorrect sometimes

See merge request sdk/ESP8266_NONOS_SDK!162
  • Loading branch information
xcguang committed Mar 14, 2019
2 parents b8fd5c2 + 22fa394 commit 9643165
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ gwen:
at : 8a853d3
crypto : 8a853d3
espnow : 8a853d3
json : 8a853d3
main : d073cbd
net80211 : 8a853d3
pp : d073cbd
Expand All @@ -18,5 +17,6 @@ phy:

gitlab:
driver : 5a2a54b4
json : f55d5fee
lwip : fa67274d
mbedtls : 6775af13
Binary file modified lib/libjson.a
Binary file not shown.
4 changes: 2 additions & 2 deletions third_party/json/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# a generated lib/image xxx.a ()
#
ifndef PDIR

UP_EXTRACT_DIR = ..
GEN_LIBS = libjson.a

endif
Expand All @@ -26,7 +26,7 @@ endif
# for a subtree within the makefile rooted therein
#
#DEFINES +=
CCFLAGS += -ffunction-sections -fdata-sections
CCFLAGS += -DJSON_FORMAT

#############################################################
# Recursion Magic - Don't touch this!!
Expand Down
9 changes: 9 additions & 0 deletions third_party/json/jsonparse.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,15 @@ jsonparse_strcmp_value(struct jsonparse_state *state, const char *str)
if(state->vtype == 0) {
return -1;
}

if (str == NULL) {
return -1;
}

if (os_strlen(str) != state->vlen) {
return -1;
}

return os_strncmp(str, &state->json[state->vstart], state->vlen);
}
/*--------------------------------------------------------------------*/
Expand Down

0 comments on commit 9643165

Please sign in to comment.