From 10fb0bfab13b7cd6cd9b22c2edced0fd3a3b8b32 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Fri, 4 Nov 2011 10:21:15 +0100 Subject: Fix off-by-one when reading link name in sprof --- elf/sprof.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'elf') diff --git a/elf/sprof.c b/elf/sprof.c index 6182599..c90c22c 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'; -- cgit v1.1