summaryrefslogtreecommitdiff
path: root/elf/sprof.c
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2011-11-04 10:21:15 +0100
committerAndreas Schwab <schwab@redhat.com>2011-11-04 10:25:00 +0100
commit10fb0bfab13b7cd6cd9b22c2edced0fd3a3b8b32 (patch)
tree9fa2633490564537fe5b208c7d9b836c814e1e68 /elf/sprof.c
parenta9ae54a136d743103cd9e266c7d22769ea440c09 (diff)
Fix off-by-one when reading link name in sprof
Diffstat (limited to 'elf/sprof.c')
-rw-r--r--elf/sprof.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/elf/sprof.c b/elf/sprof.c
index 61825999a7..c90c22c265 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';