From f74a73be20ef0b3cdaa7748b27b1f667a8bde144 Mon Sep 17 00:00:00 2001 From: Joachim Nilsson Date: Sat, 4 Jun 2016 21:21:24 +0200 Subject: [PATCH] Audit commit 1177c73: musl libc compat changes Must initialize init_request buffer to zero before communicating with Finit. Found by Coverity Scan. Signed-off-by: Joachim Nilsson --- initctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/initctl.c b/initctl.c index c45343a8..8fd864e6 100644 --- a/initctl.c +++ b/initctl.c @@ -77,17 +77,17 @@ exit: static int runlevel_get(void) { - struct init_request rq; int sd, result = 255; - - rq.cmd = INIT_CMD_GET_RUNLEVEL; - rq.magic = INIT_MAGIC; - + struct init_request rq; struct sockaddr_un sun = { .sun_family = AF_UNIX, .sun_path = INIT_SOCKET, }; + memset(&rq, 0, sizeof(rq)); + rq.cmd = INIT_CMD_GET_RUNLEVEL; + rq.magic = INIT_MAGIC; + sd = socket(AF_UNIX, SOCK_STREAM, 0); if (-1 == sd) return -1;