]> granicus.if.org Git - procps-ng/commitdiff
Fix potential bufferoverflow in pwdx
authorWerner Fink <werner@suse.de>
Mon, 20 Dec 2010 11:46:37 +0000 (12:46 +0100)
committerJan Görig <jgorig@redhat.com>
Tue, 18 Jan 2011 15:15:15 +0000 (16:15 +0100)
 Fix potential bufferoverflow in pwdx
 Novell bugzilla entry 78074

Signed-off-by: Werner Fink <werner@suse.de>
pwdx.c

diff --git a/pwdx.c b/pwdx.c
index cb96a52167104d531656836b01f2858e3d3a0a20..bda1bf11f6da5d0db9e5c0899b9a8deae2935e64 100644 (file)
--- a/pwdx.c
+++ b/pwdx.c
@@ -60,6 +60,7 @@ int main(int argc, char* argv[])
      for (i = 1; i < argc; i++) {
           if (regexec(&re, argv[i], 0, NULL, 0) != 0) {
                snprintf(buf, sizeof buf, "pwdx: invalid process id: %s\n", argv[i]);
+               buf[sizeof(buf)-1] = '\0';
                die(buf);
           }
           if (!strcmp("-V", argv[i]) || !strcmp("--version", argv[i]))