summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>2007-02-07 10:20:41 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>2007-02-07 10:20:41 +0000
commit78f7807e3b4248f4761ccb78b73fceebae689d3b (patch)
tree6da4de942d4011d4f67c4648d58fadf0f9cf2b44 /usr.bin
parent80cb4f03378b2fdb17df1c8a7a522aa397c2ee04 (diff)
check st_name validity also check for overflow and not only for zero; found by Charles Longeau <chl@tuxfamily.org>
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/nm/elf.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/nm/elf.c b/usr.bin/nm/elf.c
index cc75a17f410..888f2ffe111 100644
--- a/usr.bin/nm/elf.c
+++ b/usr.bin/nm/elf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf.c,v 1.14 2006/09/30 14:34:13 kettenis Exp $ */
+/* $OpenBSD: elf.c,v 1.15 2007/02/07 10:20:40 mickey Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
@@ -27,7 +27,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: elf.c,v 1.14 2006/09/30 14:34:13 kettenis Exp $";
+static const char rcsid[] = "$OpenBSD: elf.c,v 1.15 2007/02/07 10:20:40 mickey Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -503,7 +503,8 @@ elf_symloadx(const char *name, FILE *fp, off_t foff, Elf_Ehdr *eh,
elf_fix_sym(eh, &sbuf);
- if (!sbuf.st_name)
+ if (!sbuf.st_name ||
+ sbuf.st_name > *pstabsize)
continue;
elf2nlist(&sbuf, eh, shdr, shstr, np);