From 10983c363e4ccd7c82dc01607dbcb611150acfdc Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Fri, 31 May 2019 10:34:35 +0200 Subject: rootless: make sure the buffer is NUL terminated after we read from the pause PID file, NUL terminate the buffer to avoid reading garbage from the stack. Signed-off-by: Giuseppe Scrivano --- pkg/rootless/rootless_linux.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkg/rootless/rootless_linux.c') diff --git a/pkg/rootless/rootless_linux.c b/pkg/rootless/rootless_linux.c index 2356882e7..8608930dd 100644 --- a/pkg/rootless/rootless_linux.c +++ b/pkg/rootless/rootless_linux.c @@ -276,6 +276,8 @@ static void __attribute__((constructor)) init() free (cwd); return; } + buf[r] = '\0'; + pid = strtol (buf, NULL, 10); if (pid == LONG_MAX) { -- cgit v1.2.3-54-g00ecf