From df25b98d7c2b39b08a4a0e8d9b0d744d9a7ab7aa Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 19 Jun 2014 22:42:14 +1000 Subject: [PATCH] ckdb - breakdown missing null check for json --- src/ckdb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ckdb.c b/src/ckdb.c index ea046ddf..867956a2 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -4089,7 +4089,7 @@ static enum cmd_values breakdown(char *buf, int *which_cmds, char *cmd, char *id } next = data; - if (strncmp(next, JSON_TRANSFER, JSON_TRANSFER_LEN) == 0) { + if (next && strncmp(next, JSON_TRANSFER, JSON_TRANSFER_LEN) == 0) { json_t *json_data; json_error_t err_val; void *json_iter; @@ -4182,7 +4182,7 @@ static enum cmd_values breakdown(char *buf, int *which_cmds, char *cmd, char *id K_WLOCK(transfer_list); while (next && *next) { data = next; - next = strchr(data, 0x02); + next = strchr(data, FLDSEP); if (next) *(next++) = '\0'; @@ -4208,7 +4208,7 @@ static enum cmd_values breakdown(char *buf, int *which_cmds, char *cmd, char *id } K_WUNLOCK(transfer_list); } - +matane: free(cmdptr); return cmds[*which_cmds].cmd_val; }