diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2019-05-09 22:25:43 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2019-05-09 22:25:43 +0000 |
commit | 694dfd854041af07f6e9c055393403a3dce0c14d (patch) | |
tree | 134e96a986fbb393e43c3cf6f814411dff2d1c19 /sys | |
parent | 3418dbe429f45022e944663d6210182f7f4e0d6c (diff) |
If mallocing the array program header fails, give up on coredumping
instead of panicing
ok deraadt@, tedu@, mpi@
Diffstat (limited to 'sys')
-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; |