uci_delete: check ptr->o and its type before checking ptr->value
authorFelix Fietkau <nbd@openwrt.org>
Sun, 29 Sep 2013 11:20:34 +0000 (13:20 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 29 Sep 2013 11:20:34 +0000 (13:20 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
list.c

diff --git a/list.c b/list.c
index e6ef1c188ebf54461cc3aa6199a6e2934d2fd127..0ea7eda95cb5509f673c06464dfe6dc4818125ca 100644 (file)
--- a/list.c
+++ b/list.c
@@ -560,7 +560,7 @@ int uci_delete(struct uci_context *ctx, struct uci_ptr *ptr)
 
        UCI_ASSERT(ctx, ptr->s);
 
-       if (ptr->value && *ptr->value && ptr->o && ptr->o->type == UCI_TYPE_LIST) {
+       if (ptr->o && ptr->o->type == UCI_TYPE_LIST && ptr->value && *ptr->value) {
                if (!sscanf(ptr->value, "%d", &index))
                        return 1;