UBUS_MSG_INVOKE and UBUS_MSG_DATA can be sent without UBUS_ATTR_DATA
present. Most ubus users assume that the msg argument passed can never
be NULL, so this change prevents a crash
Signed-off-by: Felix Fietkau <nbd@nbd.name>
if (attrbuf[UBUS_ATTR_NO_REPLY])
no_reply = blob_get_int8(attrbuf[UBUS_ATTR_NO_REPLY]);
-
+
req.peer = hdr->peer;
req.seq = hdr->seq;
req.object = obj->id;
goto send;
found:
+ if (!attrbuf[UBUS_ATTR_DATA]) {
+ ret = UBUS_STATUS_INVALID_ARGUMENT;
+ goto send;
+ }
+
ret = obj->methods[method].handler(ctx, obj, &req,
blob_data(attrbuf[UBUS_ATTR_METHOD]),
attrbuf[UBUS_ATTR_DATA]);
return;
attr = ubus_parse_msg(data);
+ if (!attr[UBUS_ATTR_DATA])
+ return;
+
req->data_cb(req, type, attr[UBUS_ATTR_DATA]);
}