summaryrefslogtreecommitdiff
path: root/usr.bin/pmdb
diff options
context:
space:
mode:
authorArtur Grabowski <art@cvs.openbsd.org>2002-06-11 06:34:39 +0000
committerArtur Grabowski <art@cvs.openbsd.org>2002-06-11 06:34:39 +0000
commit043e0b6fbf2d17842e26c3e61b7800ff6cebd7b3 (patch)
treee24ec2f802b7755059839f8a6b18be4fbb6792dc /usr.bin/pmdb
parentf1bb7fb5cfe9822f50143a03473f49e825e704bc (diff)
Fail if no symbol table is found, don't crash.
Diffstat (limited to 'usr.bin/pmdb')
-rw-r--r--usr.bin/pmdb/aout_syms.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/pmdb/aout_syms.c b/usr.bin/pmdb/aout_syms.c
index aea4b3d5b97..2773ef83b90 100644
--- a/usr.bin/pmdb/aout_syms.c
+++ b/usr.bin/pmdb/aout_syms.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: aout_syms.c,v 1.7 2002/06/09 04:59:04 fgsch Exp $ */
+/* $OpenBSD: aout_syms.c,v 1.8 2002/06/11 06:34:38 art Exp $ */
/*
* Copyright (c) 2002 Federico Schwindt <fgsch@openbsd.org>
* All rights reserved.
@@ -133,6 +133,11 @@ aout_open(const char *name)
ash->ash_symsize = ahdr.a_syms;
stroff = N_STROFF(ahdr);
+ if (ahdr.a_syms == 0) {
+ warnx("No symbol table");
+ goto fail;
+ }
+
if (pread(ash->ash_fd, &ash->ash_strsize, sizeof(u_int32_t),
stroff) != sizeof(u_int32_t)) {
warn("pread(strsize)");