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 <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2016-06-04 21:21:24 +02:00
parent 34d8848b5c
commit f74a73be20
+5 -5
View File
@@ -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;