diff options
author | Brian Dessent <brian@dessent.net> | 2008-03-11 18:43:11 +0000 |
---|---|---|
committer | Brian Dessent <brian@dessent.net> | 2008-03-11 18:43:11 +0000 |
commit | 5b7296f63732d346f1748efe89d8c5d38389edbb (patch) | |
tree | 7ed7b1308b27de31f1a85fa26518a21a2f0f1b49 /winsup/utils | |
parent | 60efa4e546a8f2e8e23f2de5ccd77c8c30240162 (diff) | |
download | newlib-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')
-rw-r--r-- | winsup/utils/ChangeLog | 5 | ||||
-rw-r--r-- | winsup/utils/cygcheck.cc | 6 |
2 files changed, 8 insertions, 3 deletions
diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 288beaf..428de67 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 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)) |