From: Andreas Schwab Date: Fri, 4 Nov 2011 09:21:15 +0000 (+0100) Subject: Fix off-by-one when reading link name in sprof X-Git-Tag: glibc-2.15~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=10fb0bfab13b7cd6cd9b22c2edced0fd3a3b8b32;p=thirdparty%2Fglibc.git Fix off-by-one when reading link name in sprof --- diff --git a/ChangeLog b/ChangeLog index a65182acf94..6622603d058 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2011-11-04 Andreas Schwab + + * elf/sprof.c (load_shobj): Fix off-by-one when reading link name. + 2011-11-03 Andreas Schwab * nscd/nscd.c (main): Don't start AVC thread until credentials are diff --git a/elf/sprof.c b/elf/sprof.c index 61825999a7b..c90c22c2655 100644 --- a/elf/sprof.c +++ b/elf/sprof.c @@ -597,7 +597,7 @@ load_shobj (const char *name) char origprocname[sizeof (procpath) + sizeof (int) * 3]; snprintf (origprocname, sizeof (origprocname), procpath, fd); char *origlink = (char *) alloca (PATH_MAX); - ssize_t n = readlink (origprocname, origlink, PATH_MAX); + ssize_t n = readlink (origprocname, origlink, PATH_MAX - 1); if (n == -1) goto no_debuginfo; origlink[n] = '\0';