diff options
| author | BurnZeZ <brz-9dev@intma.in> | 2013-11-10 20:11:46 -0500 |
|---|---|---|
| committer | BurnZeZ <brz-9dev@intma.in> | 2013-11-10 20:11:46 -0500 |
| commit | f0483642be7ab5663daca6784f39e593d3e53ea2 (patch) | |
| tree | b4db6453deba2fbd55aba4a2e2b54d6db47f9a4d | |
| parent | aad22f753feae9ec435a7424c35274ebbf7e472d (diff) | |
| download | plan9front-f0483642be7ab5663daca6784f39e593d3e53ea2.tar.xz | |
libjson: check for empty string in jsonparse()
| -rw-r--r-- | sys/src/libjson/json.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/src/libjson/json.c b/sys/src/libjson/json.c index 8186976a3..8d9b7bd91 100644 --- a/sys/src/libjson/json.c +++ b/sys/src/libjson/json.c @@ -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; |
