* lib/canonicalize-lgpl.c (__realpath): readlink can write too
authorUlrich Drepper <drepper@redhat.com>
Wed, 23 Jul 2008 08:24:43 +0000 (10:24 +0200)
committerJim Meyering <meyering@redhat.com>
Wed, 23 Jul 2008 08:24:43 +0000 (10:24 +0200)
much into the buffer on platforms without PATH_MAX.

ChangeLog
lib/canonicalize-lgpl.c

index f741b9f..4d5f18e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-07-23  Ulrich Drepper  <drepper@redhat.com>
+
+       * lib/canonicalize-lgpl.c (__realpath): readlink can write too
+       much into the buffer on platforms without PATH_MAX.
+
 2008-07-21  Eric Blake  <ebb9@byu.net>
 
        Warn, not fail, on stale version.
index 80bef72..3aaa310 100644 (file)
@@ -260,7 +260,7 @@ __realpath (const char *name, char *resolved)
                  goto error;
                }
 
-             n = __readlink (rpath, buf, path_max);
+             n = __readlink (rpath, buf, path_max - 1);
              if (n < 0)
                {
                  int saved_errno = errno;