diff options
author | Mike Frysinger <vapier@gentoo.org> | 2024-01-25 00:02:51 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2024-01-25 00:02:51 -0500 |
commit | 77bf161b55dbf340f4498ad26eef3fd7a0dfbcdc (patch) | |
tree | 830096d789f04cb9e7adb9786481280efa8df37f /porting.h | |
parent | ar: handle invalid extended filename offsets (diff) | |
download | pax-utils-77bf161b55dbf340f4498ad26eef3fd7a0dfbcdc.tar.gz pax-utils-77bf161b55dbf340f4498ad26eef3fd7a0dfbcdc.tar.bz2 pax-utils-77bf161b55dbf340f4498ad26eef3fd7a0dfbcdc.zip |
ar: switch from alloca to malloc
If alloca allocates too much stack space, program behavior is undefined,
and basically we segfault. There is no way to check whether this will
happen ahead of time, so our only choice is to switch to malloc. If we
try to allocate too much memory from the heap, we'll get a NULL pointer,
and we can diagnose & exit ourselves. Kind of sucks as alloca was a
perfect fit here, but since the size is coming directly from user input,
we can't trust it is always "reasonable".
Bug: https://bugs.gentoo.org/890579
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'porting.h')
-rw-r--r-- | porting.h | 3 |
1 files changed, 0 insertions, 3 deletions
@@ -40,9 +40,6 @@ #include <time.h> #include <unistd.h> #include "elf.h" -#ifdef HAVE_ALLOCA_H -# include <alloca.h> -#endif #ifdef HAVE_SYS_PRCTL_H # include <sys/prctl.h> # ifdef HAVE_LINUX_SECCOMP_H |