elf_symloadx() are reinitialised.
Else show_file() in nm.c will used these variables, even if they has
just been freed. (nm.c +689).
Problem found by afl.
ok miod@
-/* $OpenBSD: elf.c,v 1.31 2015/06/23 15:13:29 semarie Exp $ */
+/* $OpenBSD: elf.c,v 1.32 2015/06/23 15:16:34 semarie Exp $ */
/*
* Copyright (c) 2003 Michael Shalayeff
warn("%s: malloc names", name);
if (stab)
MUNMAP(stab, *pstabsize);
+ *pnrawnames = 0;
return (1);
}
if ((*psnames = calloc(*pnrawnames, sizeof(np))) == NULL) {
if (stab)
MUNMAP(stab, *pstabsize);
free(*pnames);
+ *pnames = NULL;
+ *pnrawnames = 0;
return (1);
}
MUNMAP(stab, *pstabsize);
free(*pnames);
free(*psnames);
+ *pnames = NULL;
+ *psnames = NULL;
+ *pnrawnames = 0;
return (1);
}
-/* $OpenBSD: util.h,v 1.3 2015/05/17 20:19:08 guenther Exp $ */
+/* $OpenBSD: util.h,v 1.4 2015/06/23 15:16:34 semarie Exp $ */
/*
* Placed in the public domain by Todd C. Miller <Todd.Miller@courtesan.com>
munmap(addr, len); \
else \
free(addr); \
+ addr = NULL; \
} while (0)
extern int usemmap;