diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rtnl.c | 17 | ||||
-rw-r--r-- | lib/struct.c | 9 |
2 files changed, 15 insertions, 11 deletions
@@ -1345,10 +1345,13 @@ uc_nl_convert_attrs(struct nl_msg *msg, void *buf, size_t buflen, size_t headsiz if (!tb) return false; - if (buflen > headsize) - nla_parse(tb, maxattr, buf + headsize, buflen - headsize, NULL); - else + if (buflen > headsize) { + if (maxattr) + nla_parse(tb, maxattr, buf + headsize, buflen - headsize, NULL); + } + else { structlen = buflen; + } for (i = 0; i < nattrs; i++) { if (attrs[i].attr == 0 && (uintptr_t)attrs[i].auxdata >= structlen) @@ -3087,10 +3090,7 @@ cb_reply(struct nl_msg *msg, void *arg) } } - if (hdr->nlmsg_flags & NLM_F_MULTI) - s->state = STATE_CONTINUE; - else - s->state = STATE_REPLIED; + s->state = STATE_CONTINUE; return NL_SKIP; } @@ -3197,6 +3197,7 @@ uc_nl_request(uc_vm_t *vm, size_t nargs) nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, cb_reply, &st); nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, cb_done, &st); + nl_cb_set(cb, NL_CB_ACK, NL_CB_CUSTOM, cb_done, &st); nl_cb_err(cb, NL_CB_CUSTOM, cb_error, &st); nl_send_auto_complete(sock, msg); @@ -3210,7 +3211,7 @@ uc_nl_request(uc_vm_t *vm, size_t nargs) st.state = STATE_ERROR; } } - while (st.state == STATE_CONTINUE); + while (st.state < STATE_REPLIED); nlmsg_free(msg); nl_cb_put(cb); diff --git a/lib/struct.c b/lib/struct.c index 5d301db..bd418b2 100644 --- a/lib/struct.c +++ b/lib/struct.c @@ -2182,17 +2182,17 @@ overflow: static uc_value_t * uc_pack_common(uc_vm_t *vm, size_t nargs, formatstate_t *state, size_t argoff) { + size_t ncode, arg, off; formatcode_t *code; - size_t ncode, off; uc_string_t *buf; ssize_t size, n; const void *p; - for (ncode = 0, code = &state->codes[0], off = 0; + for (ncode = 0, code = &state->codes[0], arg = argoff, off = 0; ncode < state->ncodes; code = &state->codes[++ncode]) { if (code->fmtdef->format == '*') { - uc_value_t *v = uc_fn_arg(argoff + ncode); + uc_value_t *v = uc_fn_arg(arg++); if (ucv_type(v) != UC_STRING) continue; @@ -2204,6 +2204,9 @@ uc_pack_common(uc_vm_t *vm, size_t nargs, formatstate_t *state, size_t argoff) else off += code->size; } + else { + arg += code->repeat; + } } buf = xalloc(sizeof(*buf) + state->size + off + 1); |