From 5bd6f0c6946f06fdd8905b1cad8971e8d37d8fcc Mon Sep 17 00:00:00 2001 From: Wojciech Aleksander Woloszyn Date: Mon, 26 Aug 2024 14:30:33 +0100 Subject: [PATCH] Fix the incorrect call to memset in app/memcmp, causing undefined behavior The memset call did effectively nothing because it set zero bytes. --- app/memcmp/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/memcmp/main.c b/app/memcmp/main.c index 6e157d0..77b6ece 100644 --- a/app/memcmp/main.c +++ b/app/memcmp/main.c @@ -154,7 +154,7 @@ void register_signal_handler(int signo) struct sigaction act, old_act; /* Specify #PF handler with signinfo arguments */ - memset(&act, sizeof(sigaction), 0); + memset(&act, 0, sizeof(sigaction)); act.sa_sigaction = fault_handler; act.sa_flags = SA_RESTART | SA_SIGINFO;