From 1ad3493658fe3a3782e51efe960c07549f117a28 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 10 Oct 2011 16:47:49 +0200 Subject: [PATCH] fix invalid message reuse in ubus_process_invoke --- libubus.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) -- 2.30.2