aboutsummaryrefslogtreecommitdiff
path: root/winsup/utils/cygcheck.cc
diff options
context:
space:
mode:
authorBrian Dessent <brian@dessent.net>2008-03-11 18:43:11 +0000
committerBrian Dessent <brian@dessent.net>2008-03-11 18:43:11 +0000
commit5b7296f63732d346f1748efe89d8c5d38389edbb (patch)
tree7ed7b1308b27de31f1a85fa26518a21a2f0f1b49 /winsup/utils/cygcheck.cc
parent60efa4e546a8f2e8e23f2de5ccd77c8c30240162 (diff)
downloadnewlib-5b7296f63732d346f1748efe89d8c5d38389edbb.zip
newlib-5b7296f63732d346f1748efe89d8c5d38389edbb.tar.gz
newlib-5b7296f63732d346f1748efe89d8c5d38389edbb.tar.bz2
* cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
chars.
Diffstat (limited to 'winsup/utils/cygcheck.cc')
-rw-r--r--winsup/utils/cygcheck.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index e23a685..4d79e31 100644
--- a/winsup/utils/cygcheck.cc
+++ b/winsup/utils/cygcheck.cc
@@ -843,7 +843,7 @@ find_app_on_path (const char *app, bool showall = false)
if (is_symlink (fh))
{
- static char tmp[SYMLINK_MAX];
+ static char tmp[SYMLINK_MAX + 1];
if (!readlink (fh, tmp, SYMLINK_MAX))
display_error("readlink failed");
@@ -853,9 +853,9 @@ find_app_on_path (const char *app, bool showall = false)
if (!strchr (ptr, '\\'))
{
char *lastsep;
- strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX - 1);
+ strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX);
lastsep = strrchr (tmp, '\\');
- strncpy (lastsep+1, ptr, SYMLINK_MAX - 1 - (lastsep-tmp));
+ strncpy (lastsep+1, ptr, SYMLINK_MAX - (lastsep-tmp));
ptr = tmp;
}
if (!CloseHandle (fh))