* 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 f741b9ffcfe71a5ff7c2d2fa9d57f6136774bc3a..4d5f18e4c283f57690f5e4bb9ce3ce919a741488 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 80bef72c16ab4d518a29261c65ab30ce8467bddf..3aaa310ecd2d0883e6b8e5121e214859d28d1786 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;