From a1db2e8a92f8ac796be87728c7b5ba856505128a Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Thu, 22 Sep 2022 11:47:03 +0200 Subject: [PATCH] Fixes unitialised memory access as seen in issue #355. ==1391== Conditional jump or move depends on uninitialised value(s) ==1391== at 0x10E92F: watchers_add_read (sslh-select.c:67) ==1391== by 0x10E92F: watchers_init (sslh-select.c:59) ==1391== by 0x10E92F: main_loop (sslh-select.c:134) ==1391== by 0x10DB6D: main (sslh-main.c:285) Signed-off-by: Toni Uhlig --- sslh-select.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sslh-select.c b/sslh-select.c index aa8b14e..bf75ce6 100644 --- a/sslh-select.c +++ b/sslh-select.c @@ -52,6 +52,9 @@ static void watchers_init(watchers** w, struct listen_endpoint* listen_sockets, int num_addr_listen) { *w = malloc(sizeof(**w)); + CHECK_ALLOC(*w, "malloc"); + + memset(*w, 0, sizeof(**w)); FD_ZERO(&(*w)->fds_r); FD_ZERO(&(*w)->fds_w);