Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2014-05-19 12:29:47 +0400
committerCorinna Vinschen <corinna@vinschen.de>2014-05-19 12:29:47 +0400
commit8c14a5065dd10a81d71230dcffa77e54b44b81f7 (patch)
treea8253451ec38bf84eb8762391f740c3aea4fcfeb /winsup
parenteec106c4ec7257a89f037143d2242dc3ddde70f7 (diff)
* syscalls.cc (getusershell): Fix buffer overrun (Coverity ID 59932).
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog4
-rw-r--r--winsup/cygwin/syscalls.cc2
2 files changed, 5 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index a34fe6850..823019d37 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,7 @@
+2014-05-18 David Stacey <drstacey@tiscali.co.uk>
+
+ * syscalls.cc (getusershell): Fix buffer overrun (Coverity ID 59932).
+
2014-05-15 Corinna Vinschen <corinna@vinschen.de>
* external.cc (cygwin_internal): Use local name buffer instead of
diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc
index 3a8fabf6d..de8cf119c 100644
--- a/winsup/cygwin/syscalls.cc
+++ b/winsup/cygwin/syscalls.cc
@@ -4179,7 +4179,7 @@ getusershell ()
/* Get each non-whitespace character as part of the shell path as long as
it fits in buf. */
for (buf_idx = 0;
- ch != EOF && !isspace (ch) && buf_idx < PATH_MAX;
+ ch != EOF && !isspace (ch) && buf_idx < (PATH_MAX - 1);
buf_idx++, ch = getc (shell_fp))
buf[buf_idx] = ch;
/* Skip any trailing non-whitespace character not fitting in buf. If the