summaryrefslogtreecommitdiff
path: root/usr.bin/nm/nm.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@cvs.openbsd.org>2019-03-03 16:07:40 +0000
committerIngo Schwarze <schwarze@cvs.openbsd.org>2019-03-03 16:07:40 +0000
commit431b11ae4cff4b78d9f5a44cdd04cab8c6f6e7cb (patch)
tree8d75f1b9ec2c81e21e260e54866e3054e8192f7f /usr.bin/nm/nm.c
parent1efc295811b76c5f59bf5893a3e04f37dee46c6b (diff)
on malloc(3) failure, gracefully abort processing of the current file
rather than crashing with a NULL pointer access; patch from Benjamin Baier <programmer at netzbasis dot de>; OK otto@ deraadt@
Diffstat (limited to 'usr.bin/nm/nm.c')
-rw-r--r--usr.bin/nm/nm.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/usr.bin/nm/nm.c b/usr.bin/nm/nm.c
index 86bf940ab8e..319273dd5e0 100644
--- a/usr.bin/nm/nm.c
+++ b/usr.bin/nm/nm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nm.c,v 1.53 2017/10/27 16:47:08 mpi Exp $ */
+/* $OpenBSD: nm.c,v 1.54 2019/03/03 16:07:39 schwarze Exp $ */
/* $NetBSD: nm.c,v 1.7 1996/01/14 23:04:03 pk Exp $ */
/*
@@ -381,6 +381,7 @@ show_symtab(off_t off, u_long len, const char *name, FILE *fp)
if ((p = malloc(sizeof(ar_head.ar_name))) == NULL) {
warn("%s: malloc", name);
MUNMAP(symtab, len);
+ return (1);
}
printf("\nArchive index:\n");