libjson: check for empty string in jsonparse()

front
BurnZeZ 2013-11-10 20:11:46 -05:00
parent aad22f753f
commit f0483642be
1 changed files with 4 additions and 1 deletions

View File

@ -318,7 +318,10 @@ jsonparse(char *s)
memset(&l, 0, sizeof(l)); memset(&l, 0, sizeof(l));
l.s = s; 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) if((l.buf = mallocz(l.slen, 1)) == nil)
return nil; return nil;