pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bind920: Add a patch to avoid calling arc4random_uniform(0), which will crash.



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Thu Oct 23 19:13:49 2025 +0000
Changeset:	883f1cd00a32549009bc8787ceacaa3b28235291

Modified Files:
	bind920/Makefile
	bind920/distinfo
Added Files:
	bind920/patches/patch-lib_dns_zone.c

Log Message:
bind920: Add a patch to avoid calling arc4random_uniform(0), which will crash.

...at least on NetBSD, with a divide-by-zero exception.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=883f1cd00a32549009bc8787ceacaa3b28235291

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 bind920/Makefile                     |  1 +
 bind920/distinfo                     |  1 +
 bind920/patches/patch-lib_dns_zone.c | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+)

diffs:
diff --git a/bind920/Makefile b/bind920/Makefile
index db82059545..917e65da49 100644
--- a/bind920/Makefile
+++ b/bind920/Makefile
@@ -2,6 +2,7 @@
 
 DISTNAME=	bind-${BIND_VERSION}
 PKGNAME=	${DISTNAME:S/-P/pl/}
+PKGREVISION=	1
 CATEGORIES=	net
 MASTER_SITES=	https://downloads.isc.org/isc/bind9/${BIND_VERSION}/
 EXTRACT_SUFX=	.tar.xz
diff --git a/bind920/distinfo b/bind920/distinfo
index bde31ec23e..7040712171 100644
--- a/bind920/distinfo
+++ b/bind920/distinfo
@@ -4,3 +4,4 @@ BLAKE2s (bind-9.20.15.tar.xz) = a9f184b388370068ddb2317417750e5261af5ff0c311ad52
 SHA512 (bind-9.20.15.tar.xz) = 087d7114279274898fdc846d50216167e0895d83c3fa01372cd5f1b9a106a1ed1b4ca588d86543da8c299577f4a6762713680b8e114514badb43b03d2a0fac82
 Size (bind-9.20.15.tar.xz) = 5765964 bytes
 SHA1 (patch-configure.ac) = d3b9bb82c8e164135b93a76d5c53ad40521226e2
+SHA1 (patch-lib_dns_zone.c) = 79b44bcf8a5bafdedb4e86b17e148f29c343b96a
diff --git a/bind920/patches/patch-lib_dns_zone.c b/bind920/patches/patch-lib_dns_zone.c
new file mode 100644
index 0000000000..82e996b47b
--- /dev/null
+++ b/bind920/patches/patch-lib_dns_zone.c
@@ -0,0 +1,19 @@
+$NetBSD$
+
+Avoid division by zero on NetBSD, when arc4random_uniform(0) ends
+up being called...
+
+--- lib/dns/zone.c.orig	2025-10-23 18:46:39.034862846 +0000
++++ lib/dns/zone.c
+@@ -1035,8 +1035,9 @@ static const char *dbargv_default[] = { 
+ #define DNS_ZONE_JITTER_ADD(a, b, c)                                         \
+ 	do {                                                                 \
+ 		isc_interval_t _i;                                           \
+-		uint32_t _j;                                                 \
+-		_j = (b) - isc_random_uniform((b) / 4);                      \
++		uint32_t _j, _b = b;                                         \
++		if (_b < 4) { _b = 4; }					     \
++		_j = (_b) - isc_random_uniform((_b) / 4);                    \
+ 		isc_interval_set(&_i, _j, 0);                                \
+ 		if (isc_time_add((a), &_i, (c)) != ISC_R_SUCCESS) {          \
+ 			dns_zone_log(zone, ISC_LOG_WARNING,                  \


Home | Main Index | Thread Index | Old Index