From: Felix Fietkau Date: Mon, 10 Oct 2011 14:47:49 +0000 (+0200) Subject: fix invalid message reuse in ubus_process_invoke X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1ad3493658fe3a3782e51efe960c07549f117a28;p=oweals%2Fubus.git fix invalid message reuse in ubus_process_invoke --- diff --git a/libubus.c b/libubus.c index af8cc46..f3859b7 100644 --- a/libubus.c +++ b/libubus.c @@ -342,6 +342,8 @@ static void ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hd int method; int ret = 0; + req.peer = hdr->peer; + req.seq = hdr->seq; ubus_parse_msg(hdr->data); if (!attrbuf[UBUS_ATTR_OBJID]) @@ -372,8 +374,6 @@ static void ubus_process_invoke(struct ubus_context *ctx, struct ubus_msghdr *hd found: req.object = objid; - req.peer = hdr->peer; - req.seq = hdr->seq; ret = obj->methods[method].handler(ctx, obj, &req, blob_data(attrbuf[UBUS_ATTR_METHOD]), attrbuf[UBUS_ATTR_DATA]); @@ -382,7 +382,7 @@ send: blob_buf_init(&b, 0); blob_put_int32(&b, UBUS_ATTR_STATUS, ret); blob_put_int32(&b, UBUS_ATTR_OBJID, objid); - ubus_send_msg(ctx, hdr->seq, b.head, UBUS_MSG_STATUS, hdr->peer); + ubus_send_msg(ctx, req.seq, b.head, UBUS_MSG_STATUS, req.peer); } static void ubus_process_msg(struct ubus_context *ctx, struct ubus_msghdr *hdr)