projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adds check for numberio during verify phase.
[fio.git]
/
json.c
diff --git
a/json.c
b/json.c
index ea61af72c422ad575238eaef2f4b4b2153a471d2..cba370ab4bdc59f70c425f9cea38fd63f4e47829 100644
(file)
--- a/
json.c
+++ b/
json.c
@@
-63,24
+63,28
@@
static char *strdup_escape(const char *str)
char *p, *ret;
int escapes;
char *p, *ret;
int escapes;
+ if (!strlen(str))
+ return NULL;
+
escapes = 0;
while ((input = strpbrk(input, "\\\"")) != NULL) {
escapes++;
input++;
}
escapes = 0;
while ((input = strpbrk(input, "\\\"")) != NULL) {
escapes++;
input++;
}
- p = ret = malloc(strlen(str) + escapes);
+ p = ret = malloc(strlen(str) + escapes
+ 1
);
while (*str) {
if (*str == '\\' || *str == '\"')
*p++ = '\\';
*p++ = *str++;
}
while (*str) {
if (*str == '\\' || *str == '\"')
*p++ = '\\';
*p++ = *str++;
}
+ *p = '\0';
return ret;
}
/*
return ret;
}
/*
- * Valid JSON strings must escape '"' and '/' with a prece
e
ding '/'
+ * Valid JSON strings must escape '"' and '/' with a preceding '/'
*/
static struct json_value *json_create_value_string(const char *str)
{
*/
static struct json_value *json_create_value_string(const char *str)
{