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
diff options
context:
space:
mode:
authorBrian Dessent <brian@dessent.net>2008-03-11 21:43:11 +0300
committerBrian Dessent <brian@dessent.net>2008-03-11 21:43:11 +0300
commit5b7296f63732d346f1748efe89d8c5d38389edbb (patch)
tree7ed7b1308b27de31f1a85fa26518a21a2f0f1b49 /winsup/utils
parent60efa4e546a8f2e8e23f2de5ccd77c8c30240162 (diff)
* cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
chars.
Diffstat (limited to 'winsup/utils')
-rw-r--r--winsup/utils/ChangeLog5
-rw-r--r--winsup/utils/cygcheck.cc6
2 files changed, 8 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog
index 288beafd0..428de6742 100644
--- a/winsup/utils/ChangeLog
+++ b/winsup/utils/ChangeLog
@@ -1,5 +1,10 @@
2008-03-11 Brian Dessent <brian@dessent.net>
+ * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
+ chars.
+
+2008-03-11 Brian Dessent <brian@dessent.net>
+
* cygcheck.cc (dirname): New static function.
(find_app_on_path): Use SYMLINK_MAX. Resolve symlink relative
to link's location. Adjust to the fact that cygpath already
diff --git a/winsup/utils/cygcheck.cc b/winsup/utils/cygcheck.cc
index e23a6858e..4d79e3140 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))