From 1493b9464ea6327351d351c76008c93509a62b15 Mon Sep 17 00:00:00 2001 From: brynet <> Date: Fri, 3 Jul 2015 14:50:14 +0000 Subject: [PATCH] bzero cmsgbuf before using it, silences valgrind warnings. henning@ "sure" --- src/lib/libutil/imsg-buffer.c | 3 ++- src/lib/libutil/imsg.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/libutil/imsg-buffer.c b/src/lib/libutil/imsg-buffer.c index 318f9184..00e03b9d 100644 --- a/src/lib/libutil/imsg-buffer.c +++ b/src/lib/libutil/imsg-buffer.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg-buffer.c,v 1.5 2014/12/25 22:20:52 benno Exp $ */ +/* $OpenBSD: imsg-buffer.c,v 1.6 2015/07/03 14:50:14 brynet Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -235,6 +235,7 @@ msgbuf_write(struct msgbuf *msgbuf) bzero(&iov, sizeof(iov)); bzero(&msg, sizeof(msg)); + bzero(&cmsgbuf, sizeof(cmsgbuf)); TAILQ_FOREACH(buf, &msgbuf->bufs, entry) { if (i >= IOV_MAX) break; diff --git a/src/lib/libutil/imsg.c b/src/lib/libutil/imsg.c index 0c1c782e..cbb08821 100644 --- a/src/lib/libutil/imsg.c +++ b/src/lib/libutil/imsg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: imsg.c,v 1.7 2015/06/11 19:25:53 reyk Exp $ */ +/* $OpenBSD: imsg.c,v 1.8 2015/07/03 14:50:14 brynet Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -58,6 +58,7 @@ imsg_read(struct imsgbuf *ibuf) struct imsg_fd *ifd; bzero(&msg, sizeof(msg)); + bzero(&cmsgbuf, sizeof(cmsgbuf)); iov.iov_base = ibuf->r.buf + ibuf->r.wpos; iov.iov_len = sizeof(ibuf->r.buf) - ibuf->r.wpos;