|
|
@ -6,8 +6,8 @@ size_t scan_jsonescape(const char *src,char *dest,size_t *destlen) {
|
|
|
|
register const unsigned char* s=(const unsigned char*) src;
|
|
|
|
register const unsigned char* s=(const unsigned char*) src;
|
|
|
|
size_t written=0,i;
|
|
|
|
size_t written=0,i;
|
|
|
|
char c;
|
|
|
|
char c;
|
|
|
|
unsigned int prev,cur,todo;
|
|
|
|
unsigned int prev,todo;
|
|
|
|
prev=cur=(unsigned int)-1;
|
|
|
|
prev=(unsigned int)-1;
|
|
|
|
for (i=0; s[i]; ++i) {
|
|
|
|
for (i=0; s[i]; ++i) {
|
|
|
|
if (s[i]=='"') {
|
|
|
|
if (s[i]=='"') {
|
|
|
|
if (prev!=(unsigned int)-1) goto abort;
|
|
|
|
if (prev!=(unsigned int)-1) goto abort;
|
|
|
@ -27,6 +27,7 @@ size_t scan_jsonescape(const char *src,char *dest,size_t *destlen) {
|
|
|
|
case 'u':
|
|
|
|
case 'u':
|
|
|
|
{
|
|
|
|
{
|
|
|
|
size_t j;
|
|
|
|
size_t j;
|
|
|
|
|
|
|
|
unsigned int cur;
|
|
|
|
for (cur=j=0; j<4; ++j) {
|
|
|
|
for (cur=j=0; j<4; ++j) {
|
|
|
|
char x=scan_fromhex(s[i+2+j]);
|
|
|
|
char x=scan_fromhex(s[i+2+j]);
|
|
|
|
if (x<0) goto abort; // not hex -> invalid input
|
|
|
|
if (x<0) goto abort; // not hex -> invalid input
|
|
|
|