ubusd: add missing NULL pointer checks for ACL processing
authorFelix Fietkau <nbd@openwrt.org>
Wed, 13 Jan 2016 11:28:37 +0000 (12:28 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 13 Jan 2016 11:29:01 +0000 (12:29 +0100)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
ubusd_acl.c

index eb5cec55aeb14aae42864ca6b69e878636985199..15a58d8b2cd659eb97fe2a47f61101a128dcf2e1 100644 (file)
@@ -105,6 +105,9 @@ ubusd_acl_check(struct ubus_client *cl, const char *obj,
                return 0;
 
        acl = avl_find_ge_element(&ubusd_acls, obj, acl, avl);
+       if (!acl)
+               return -1;
+
        avl_for_element_to_last(&ubusd_acls, acl, acl, avl) {
                int diff = ubusd_acl_match_path(obj, acl->avl.key, NULL);
 
@@ -415,6 +418,9 @@ ubusd_reply_add(struct ubus_object *obj)
                return;
 
        acl = avl_find_ge_element(&ubusd_acls, obj->path.key, acl, avl);
+       if (!acl)
+               return;
+
        avl_for_element_to_last(&ubusd_acls, acl, acl, avl) {
                void *c;