[CRIU] [PATCH] test: Zeroify scm buffer before filling

Pavel Emelyanov xemul at virtuozzo.com
Fri Aug 18 18:19:48 MSK 2017


The CMSG_NXTHDR checks the length of the __next__ cmsg, i.e. the one
that it is about to return for filling. Thus, keeping there anything
but zeroes is unsafe.

Reported-by: Pavel Tikhomirov <snorcht at gmail.com>
Signed-off-by: Pavel Emelyanov <xemul at virtuozzo.com>
---
 test/zdtm/static/scm03.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/test/zdtm/static/scm03.c b/test/zdtm/static/scm03.c
index 881bdf8..cf60497 100644
--- a/test/zdtm/static/scm03.c
+++ b/test/zdtm/static/scm03.c
@@ -22,6 +22,7 @@ static int send_fd(int via, int fd1, int fd2)
 	char c = '\0';
 	int *fdp;
 
+	memset(buf, 0, sizeof(buf));
 	h.msg_control = buf;
 	h.msg_controllen = sizeof(buf);
 #ifdef SEPARATE
-- 
2.1.4


More information about the CRIU mailing list