security/samhain: don't use sbrk

Samhain has an internal malloc implementation that uses sbrk and malloc.
There's a fallback during initialization if sbrk fails so replace sbrk
calls with a function that return the failure value ((void *)-1).

PR:		275646
Approved by:	freebsd@gregv.net (maintainer)
This commit is contained in:
Brooks Davis 2023-12-05 23:52:36 +00:00
parent 04af7fb01c
commit 4bfc940087
2 changed files with 22 additions and 1 deletions

View file

@ -14,7 +14,7 @@ LICENSE= GPLv2
BROKEN_mips= fails to configure: error: Could not find the libwrap library
BROKEN_mips64= fails to configure: error: Could not find the libwrap library
USES= sbrk shebangfix
USES= shebangfix
SHEBANG_FILES= scripts/samhainadmin-gpg.pl.in \
scripts/samhainadmin-sig.pl.in

View file

@ -0,0 +1,21 @@
--- src/dnmalloc.c.orig
+++ src/dnmalloc.c
@@ -660,8 +660,18 @@
sample version for pre-OSX macos.
*/
+#ifdef __FreeBSD__
+static void *nosbrk(ptrdiff_t len __unused) {
+ return MORECORE_FAILURE;
+}
+#endif
+
#ifndef MORECORE
+#ifdef __FreeBSD__
+#define MORECORE nosbrk
+#else
#define MORECORE sbrk
+#endif
#endif