libjson: check for empty string in jsonparse()
This commit is contained in:
parent
aad22f753f
commit
f0483642be
1 changed files with 4 additions and 1 deletions
|
@ -318,7 +318,10 @@ jsonparse(char *s)
|
|||
|
||||
memset(&l, 0, sizeof(l));
|
||||
l.s = s;
|
||||
l.slen = strlen(s)+1;
|
||||
if((l.slen = strlen(s)) == 0){
|
||||
werrstr("empty string");
|
||||
return nil;
|
||||
}
|
||||
if((l.buf = mallocz(l.slen, 1)) == nil)
|
||||
return nil;
|
||||
|
||||
|
|
Loading…
Reference in a new issue