aboutgitcodelistschat:MatrixIRC
path: root/operations.c
diff options
context:
space:
mode:
authorAlice Frosi <afrosi@redhat.com>2023-07-14 12:48:37 +0200
committerAlice Frosi <afrosi@redhat.com>2023-07-14 12:48:37 +0200
commit2878f461e18869d7a63a6994a2e43fce05338c1b (patch)
treed8915ab47bb10dad06ce3db1559ac7fa4d649ec3 /operations.c
parent39e878725b2c71d10726c97a69a7e12331c47f24 (diff)
downloadseitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar.gz
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar.bz2
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar.lz
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar.xz
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.tar.zst
seitan-2878f461e18869d7a63a6994a2e43fce05338c1b.zip
common, ops: add error print and return if desc is empty
Diffstat (limited to 'operations.c')
-rw-r--r--operations.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/operations.c b/operations.c
index c8af0ad..b5e536a 100644
--- a/operations.c
+++ b/operations.c
@@ -93,7 +93,6 @@ static int prepare_arg_clone(const struct seccomp_notif *req, struct gluten *g,
c->err = 0;
c->ret = -1;
c->nr = s->nr;
-
for (i = 0; i < s->arg_count; i++) {
/* If arg is a pointer then need to calculate the absolute
* address and the value of arg is the relative offset of the actual
@@ -237,8 +236,8 @@ static int execute_syscall(void *args)
c->ret = syscall(c->nr, c->args[0], c->args[1], c->args[2], c->args[3],
c->args[4], c->args[5]);
c->err = errno;
- debug(" execute syscall: ret=%ld errno=%d%s%s", c->ret, c->err,
- *c->cwd ? " cwd=" : "", *c->cwd ? c->cwd : "");
+ debug(" execute syscall %ld: ret=%ld errno=%d%s%s", c->nr, c->ret,
+ c->err, *c->cwd ? " cwd=" : "", *c->cwd ? c->cwd : "");
if (c->ret < 0) {
perror(" syscall");
exit(EXIT_FAILURE);
@@ -380,6 +379,9 @@ int op_return(const struct seccomp_notif *req, int notifier, struct gluten *g,
const struct return_desc *desc = gluten_ptr(&req->data, g, op->desc);
struct seccomp_notif_resp resp;
+ if(desc == NULL)
+ ret_err(-1, "empty description for return value");
+
resp.id = req->id;
if (desc->cont) {
resp.flags = SECCOMP_USER_NOTIF_FLAG_CONTINUE;