delta: prevent possible null pointer use
[project/uci.git] / delta.c
diff --git a/delta.c b/delta.c
index 52ebe3beb3b6af196d3ef38fea6d6f1b67b84ffe..d8bd3a6ccae8d0a6330c9660b3b5ee294cda1a3c 100644 (file)
--- a/delta.c
+++ b/delta.c
@@ -198,6 +198,7 @@ static inline int uci_parse_delta_tuple(struct uci_context *ctx, struct uci_ptr
        case UCI_CMD_LIST_ADD:
                if (!ptr->option)
                        goto error;
+               /* fall through */
        case UCI_CMD_LIST_DEL:
                if (!ptr->option)
                        goto error;
@@ -391,7 +392,7 @@ static void uci_filter_delta(struct uci_context *ctx, const char *name, const ch
                                match = false;
                }
 
-               if (!match) {
+               if (!match && ptr.section) {
                        uci_add_delta(ctx, &list, c,
                                ptr.section, ptr.option, ptr.value);
                }