aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2024-01-25 00:02:51 -0500
committerMike Frysinger <vapier@gentoo.org>2024-01-25 00:02:51 -0500
commit77bf161b55dbf340f4498ad26eef3fd7a0dfbcdc (patch)
tree830096d789f04cb9e7adb9786481280efa8df37f /porting.h
parentar: handle invalid extended filename offsets (diff)
downloadpax-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.h3
1 files changed, 0 insertions, 3 deletions
diff --git a/porting.h b/porting.h
index 68e2b6c..103d268 100644
--- a/porting.h
+++ b/porting.h
@@ -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