From abccd307f468012652f5347c46a3877a975fa108 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 3 Feb 2008 03:05:03 +0100 Subject: [PATCH] some extra null pointer checks --- cli.c | 4 ++++ file.c | 3 +++ 2 files changed, 7 insertions(+) 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; -- 2.25.1