diff options
author | 2019-05-09 22:25:42 +0000 | |
---|---|---|
committer | 2019-05-09 22:25:42 +0000 | |
commit | f0b7d25f7b90f0594dddc8db758a9ab5bc2c1941 (patch) | |
tree | 913af9c3727eb31cd175b5dcbf0acdbb9a2561de /sys/kern/exec_elf.c | |
parent | Simplify v4_config() and v6_config() by getting updated information (diff) | |
download | wireguard-openbsd-f0b7d25f7b90f0594dddc8db758a9ab5bc2c1941.tar.xz wireguard-openbsd-f0b7d25f7b90f0594dddc8db758a9ab5bc2c1941.zip |
If mallocing the array program header fails, give up on coredumping
instead of panicing
ok deraadt@, tedu@, mpi@
Diffstat (limited to 'sys/kern/exec_elf.c')
-rw-r--r-- | sys/kern/exec_elf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/exec_elf.c b/sys/kern/exec_elf.c index 08e777884b4..727785cc8bf 100644 --- a/sys/kern/exec_elf.c +++ b/sys/kern/exec_elf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec_elf.c,v 1.148 2019/04/20 23:11:20 deraadt Exp $ */ +/* $OpenBSD: exec_elf.c,v 1.149 2019/05/09 22:25:42 guenther Exp $ */ /* * Copyright (c) 1996 Per Fogelstrom @@ -1143,7 +1143,9 @@ coredump_setup_elf(int segment_count, void *cookie) * the section sizes and offsets */ ws->psections = mallocarray(ws->npsections, sizeof(Elf_Phdr), - M_TEMP, M_WAITOK|M_ZERO); + M_TEMP, M_WAITOK|M_CANFAIL|M_ZERO); + if (ws->psections == NULL) + return ENOMEM; ws->psectionslen = ws->npsections * sizeof(Elf_Phdr); ws->notestart = ehdr.e_phoff + ws->psectionslen; |