From f07f9a28e6466b72918777fb0aff047d683b3130 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Fri, 19 May 2023 14:57:50 +0200 Subject: ops: fix op_cmp and test --- operations.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'operations.c') diff --git a/operations.c b/operations.c index 8d8b926..c751919 100644 --- a/operations.c +++ b/operations.c @@ -345,6 +345,7 @@ int op_cmp(const struct seccomp_notif *req, int notifier, struct gluten *g, const void *py = gluten_ptr(&req->data, g, op->y); enum op_cmp_type cmp = op->cmp; int res; + int jmp; (void)notifier; @@ -357,10 +358,15 @@ int op_cmp(const struct seccomp_notif *req, int notifier, struct gluten *g, if ((res == 0 && (cmp == CMP_EQ || cmp == CMP_LE || cmp == CMP_GE)) || (res < 0 && (cmp == CMP_LT || cmp == CMP_LE)) || (res > 0 && (cmp == CMP_GT || cmp == CMP_GE)) || - (res != 0 && (cmp == CMP_NE))) + (res != 0 && (cmp == CMP_NE))) { + debug(" execute op_cmp: successful comparison"); return 0; + } - return op->jmp.offset; + if (gluten_read(NULL, g, &jmp, op->jmp, sizeof(jmp)) == -1) + return -1; + debug(" execute op_cmp: jump to %d", jmp); + return jmp; } int op_resolve_fd(const struct seccomp_notif *req, int notifier, -- cgit v1.2.3