about summary refs log tree commit diff
path: root/stdlib
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-06-26 00:42:12 +0000
committerUlrich Drepper <drepper@redhat.com>2008-06-26 00:42:12 +0000
commit104426b6542145c5c5be9ccc4a32afb2dbb05674 (patch)
tree3c13449d4c075efc808637e568894f0f4d5060d6 /stdlib
parent4cb8e687affcc5323b2a330ac55d40a15d573ccf (diff)
downloadglibc-104426b6542145c5c5be9ccc4a32afb2dbb05674.tar.gz
glibc-104426b6542145c5c5be9ccc4a32afb2dbb05674.tar.xz
glibc-104426b6542145c5c5be9ccc4a32afb2dbb05674.zip
[BZ #6654]
2008-06-25  Ulrich Drepper  <drepper@redhat.com>
	[BZ #6654]
	* stdlib/canonicalize.c (__realpath): readlink can write too much
	into the buffer on platforms without PATH_MAX.
Diffstat (limited to 'stdlib')
-rw-r--r--stdlib/canonicalize.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 19808b50d6..67e4d05535 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -1,5 +1,5 @@
 /* Return the canonical absolute name of a given file.
-   Copyright (C) 1996-2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 1996-2002,2004,2005,2006,2008 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -173,7 +173,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)
 		goto error;
 	      buf[n] = '\0';