From: Brian Dessent Date: Tue, 11 Mar 2008 18:43:11 +0000 (+0000) Subject: * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1 X-Git-Tag: sid-snapshot-20080401~54 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=5b7296f63732d346f1748efe89d8c5d38389edbb;p=newlib-cygwin.git * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1 chars. --- diff --git a/winsup/utils/ChangeLog b/winsup/utils/ChangeLog index 288beafd0..428de6742 100644 --- a/winsup/utils/ChangeLog +++ b/winsup/utils/ChangeLog @@ -1,3 +1,8 @@ +2008-03-11 Brian Dessent + + * cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1 + chars. + 2008-03-11 Brian Dessent * cygcheck.cc (dirname): New static function. 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))