From: Werner Fink <werner@suse.de>
Date: Mon, 20 Dec 2010 11:46:37 +0000 (+0100)
Subject: Fix potential bufferoverflow in pwdx
X-Git-Tag: v3.3.0~37
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9564bfc6f0436350ffb4995217fc654b3874f96b;p=procps-ng

Fix potential bufferoverflow in pwdx

 Fix potential bufferoverflow in pwdx
 Novell bugzilla entry 78074

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

diff --git a/pwdx.c b/pwdx.c
index cb96a521..bda1bf11 100644
--- 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]))