From f219fada2e1107ce1a0f69bab03ee93d92d7b6f3 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Mon, 27 Feb 2023 10:55:31 +0100 Subject: seitan: copy immediate args with op_copy --- operations.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'operations.c') diff --git a/operations.c b/operations.c index cd67ccc..6b19212 100644 --- a/operations.c +++ b/operations.c @@ -169,15 +169,18 @@ int copy_args(struct seccomp_notif *req, struct op_copy_args *copy, void *data, fprintf(stderr, "the seccomp request isn't valid anymore\n"); return -1; } - for (i = 0; i < 6; i++) { - if (!copy->args[i].need_copied) - continue; - dest = (uint16_t *)data + copy->args[i].args_off; - nread = pread(fd, dest, copy->args[i].size, req->data.args[i]); - if (nread < 0) { - perror("pread"); - return -1; + if (copy->args[i].type == REFERENCE) { + dest = (uint16_t *)data + copy->args[i].args_off; + nread = pread(fd, dest, copy->args[i].size, + req->data.args[i]); + if (nread < 0) { + perror("pread"); + return -1; + } + } else { + memcpy((uint16_t *)data + copy->args[i].args_off, + &req->data.args[i], copy->args[i].size); } } close(fd); -- cgit v1.2.3