]> sourceware.org Git - newlib-cygwin.git/commitdiff
* cygcheck.cc (find_app_on_path): Make buffer SYMLINK_MAX + 1
authorBrian Dessent <brian@dessent.net>
Tue, 11 Mar 2008 18:43:11 +0000 (18:43 +0000)
committerBrian Dessent <brian@dessent.net>
Tue, 11 Mar 2008 18:43:11 +0000 (18:43 +0000)
chars.

winsup/utils/ChangeLog
winsup/utils/cygcheck.cc

index 288beafd0013c5860ce89001898bc482277c8ed2..428de674277b1377e8a557effe20459f959689c6 100644 (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>
 
        * cygcheck.cc (dirname): New static function.
index e23a6858e47a282d31f699756ad035db0d356e29..4d79e3140d8fb2de888a8d461f8b4c08d0a6ebad 100644 (file)
@@ -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))
This page took 0.036996 seconds and 5 git commands to generate.