diff options
author | Felix Fietkau <nbd@nbd.name> | 2016-08-23 11:36:41 +0200 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-08-23 11:36:41 +0200 |
commit | b405050ceb53a0f7fce5a3e0958b6e5406e9225b (patch) | |
tree | ae802901583a08ae3577cbbb0325f2cb09f96d6a | |
parent | 053be7df871e05478284235732f8b0608089512f (diff) | |
download | ubus-b405050ceb53a0f7fce5a3e0958b6e5406e9225b.tar.gz |
ubusd: add missing NULL pointer checks for obj->type
Signed-off-by: Felix Fietkau <nbd@nbd.name>
-rw-r--r-- | ubusd_proto.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/ubusd_proto.c b/ubusd_proto.c index 0af11f2..0624574 100644 --- a/ubusd_proto.c +++ b/ubusd_proto.c @@ -146,7 +146,7 @@ static int ubusd_handle_add_object(struct ubus_client *cl, struct ubus_msg_buf * blob_buf_init(&b, 0); blob_put_int32(&b, UBUS_ATTR_OBJID, obj->id.id); - if (attr[UBUS_ATTR_SIGNATURE]) + if (attr[UBUS_ATTR_SIGNATURE] && obj->type) blob_put_int32(&b, UBUS_ATTR_OBJTYPE, obj->type->id.id); ubus_proto_send_msg_from_blob(cl, ub, UBUS_MSG_DATA); @@ -159,6 +159,9 @@ static void ubusd_send_obj(struct ubus_client *cl, struct ubus_msg_buf *ub, stru int cnt = 0; void *s; + if (!obj->type) + return; + blob_buf_init(&b, 0); blob_put_string(&b, UBUS_ATTR_OBJPATH, obj->path.key); |