From: Felix Fietkau Date: Sun, 3 Feb 2008 02:05:03 +0000 (+0100) Subject: some extra null pointer checks X-Git-Url: http://pilppa.org/gitweb/?a=commitdiff_plain;h=abccd307f468012652f5347c46a3877a975fa108;p=uci.git some extra null pointer checks --- diff --git a/cli.c b/cli.c index e14757e..845fc2a 100644 --- a/cli.c +++ b/cli.c @@ -101,6 +101,8 @@ static int package_cmd(int cmd, char *package) cli_perror(); return 1; } + if (!p) + return 0; switch(cmd) { case CMD_COMMIT: if (uci_commit(ctx, &p, false) != UCI_OK) @@ -212,6 +214,8 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv) cli_perror(); return 1; } + if (!p) + return 0; switch(cmd) { case CMD_GET: diff --git a/file.c b/file.c index 4b607f8..416422d 100644 --- a/file.c +++ b/file.c @@ -453,6 +453,9 @@ static void uci_parse_line(struct uci_context *ctx, bool single) char *pbrk = NULL; word = strtok_r(word, " \t", &pbrk); + if (!word) + continue; + switch(word[0]) { case '#': return;