diff --git a/libs/esl/src/esl_json.c b/libs/esl/src/esl_json.c index 5a994ae062..2926a3230b 100644 --- a/libs/esl/src/esl_json.c +++ b/libs/esl/src/esl_json.c @@ -163,7 +163,7 @@ static const char *parse_string(cJSON *item,const char *str) case 'r': *ptr2++='\r'; break; case 't': *ptr2++='\t'; break; case 'u': // transcode utf16 to utf8. DOES NOT SUPPORT SURROGATE PAIRS CORRECTLY. - sscanf(ptr+1,"%4x",&uc); // get the unicode char. + if (sscanf(ptr+1,"%4x",&uc) < 1) break; // get the unicode char. len=3;if (uc<0x80) len=1;else if (uc<0x800) len=2;ptr2+=len; switch (len) { diff --git a/src/switch_json.c b/src/switch_json.c index 814f69644a..e0e27ba70f 100644 --- a/src/switch_json.c +++ b/src/switch_json.c @@ -162,7 +162,7 @@ static const char *parse_string(cJSON *item,const char *str) case 'r': *ptr2++='\r'; break; case 't': *ptr2++='\t'; break; case 'u': // transcode utf16 to utf8. DOES NOT SUPPORT SURROGATE PAIRS CORRECTLY. - sscanf(ptr+1,"%4x",&uc); // get the unicode char. + if (sscanf(ptr+1,"%4x",&uc) < 1) break; // get the unicode char. len=3;if (uc<0x80) len=1;else if (uc<0x800) len=2;ptr2+=len; switch (len) {