* cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1

chars.
This commit is contained in:
Brian Dessent 2008-03-11 18:43:11 +00:00
parent 60efa4e546
commit 5b7296f637
2 changed files with 8 additions and 3 deletions

View File

@ -1,3 +1,8 @@
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> 2008-03-11 Brian Dessent <brian@dessent.net>
* cygcheck.cc (dirname): New static function. * cygcheck.cc (dirname): New static function.

View File

@ -843,7 +843,7 @@ find_app_on_path (const char *app, bool showall = false)
if (is_symlink (fh)) if (is_symlink (fh))
{ {
static char tmp[SYMLINK_MAX]; static char tmp[SYMLINK_MAX + 1];
if (!readlink (fh, tmp, SYMLINK_MAX)) if (!readlink (fh, tmp, SYMLINK_MAX))
display_error("readlink failed"); display_error("readlink failed");
@ -853,9 +853,9 @@ find_app_on_path (const char *app, bool showall = false)
if (!strchr (ptr, '\\')) if (!strchr (ptr, '\\'))
{ {
char *lastsep; char *lastsep;
strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX - 1); strncpy (tmp, cygpath (papp, NULL), SYMLINK_MAX);
lastsep = strrchr (tmp, '\\'); lastsep = strrchr (tmp, '\\');
strncpy (lastsep+1, ptr, SYMLINK_MAX - 1 - (lastsep-tmp)); strncpy (lastsep+1, ptr, SYMLINK_MAX - (lastsep-tmp));
ptr = tmp; ptr = tmp;
} }
if (!CloseHandle (fh)) if (!CloseHandle (fh))