ubusd_proto: fix crash when trying to subscribe to system objects
authorFelix Fietkau <nbd@nbd.name>
Sun, 20 Nov 2016 15:40:06 +0000 (16:40 +0100)
committerFelix Fietkau <nbd@nbd.name>
Sun, 20 Nov 2016 15:40:06 +0000 (16:40 +0100)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
ubusd_proto.c

index 53e507ad22b393ff31a547341fa0840317c88852..b591384283ed0669e3b2f0234ec11c31a2c3f74f 100644 (file)
@@ -377,7 +377,7 @@ static int ubusd_handle_add_watch(struct ubus_client *cl, struct ubus_msg_buf *u
                return UBUS_STATUS_INVALID_ARGUMENT;
 
        target = ubusd_find_object(blob_get_u32(attr[UBUS_ATTR_TARGET]));
-       if (!target)
+       if (!target || !target->client)
                return UBUS_STATUS_NOT_FOUND;
 
        if (cl == target->client)