summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2021-01-24 22:27:29 -0500
committerMike Gilbert <floppym@gentoo.org>2021-01-24 22:27:51 -0500
commitf70bc63e84eb5797b02ec3aa6d972d2f1f8bc55a (patch)
treec1a581f1e3763d9b5c2516324bf99d7c007969c1 /net-misc/iputils
parentapp-crypt/gcr: Version bump to 3.38.1 (diff)
downloadgentoo-f70bc63e84eb5797b02ec3aa6d972d2f1f8bc55a.tar.gz
gentoo-f70bc63e84eb5797b02ec3aa6d972d2f1f8bc55a.tar.bz2
gentoo-f70bc63e84eb5797b02ec3aa6d972d2f1f8bc55a.zip
net-misc/iputils: fix fallback code when getrandom fails
Closes: https://bugs.gentoo.org/738842 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'net-misc/iputils')
-rw-r--r--net-misc/iputils/files/iputils-20200821-getrandom-fallback.patch43
-rw-r--r--net-misc/iputils/iputils-20200821-r1.ebuild (renamed from net-misc/iputils/iputils-20200821.ebuild)6
2 files changed, 47 insertions, 2 deletions
diff --git a/net-misc/iputils/files/iputils-20200821-getrandom-fallback.patch b/net-misc/iputils/files/iputils-20200821-getrandom-fallback.patch
new file mode 100644
index 000000000000..5b69e5c88fb7
--- /dev/null
+++ b/net-misc/iputils/files/iputils-20200821-getrandom-fallback.patch
@@ -0,0 +1,43 @@
+From 469b41ac89b9f6772ea31df8379669d205be95f8 Mon Sep 17 00:00:00 2001
+From: Nuno Silva <nuno.m.ribeiro.silva@tecnico.ulisboa.pt>
+Date: Mon, 24 Aug 2020 19:34:53 +0100
+Subject: [PATCH] common: fix infinite loop when getrandom fails
+
+Fixes: https://github.com/iputils/iputils/issues/291
+---
+ iputils_common.c | 14 ++++++++++----
+ 1 file changed, 10 insertions(+), 4 deletions(-)
+
+diff --git a/iputils_common.c b/iputils_common.c
+index 58eacd0..c41f201 100644
+--- a/iputils_common.c
++++ b/iputils_common.c
+@@ -98,18 +98,24 @@ static unsigned int iputil_srand_fallback(void)
+ void iputils_srand(void)
+ {
+ unsigned int i;
++
+ #if HAVE_GETRANDOM
+ ssize_t ret;
+
+- while ((ret = getrandom(&i, sizeof(i), GRND_NONBLOCK)) != sizeof(i)) {
+- switch(errno) {
++ do {
++ errno = 0;
++ ret = getrandom(&i, sizeof(i), GRND_NONBLOCK);
++ switch (errno) {
++ case 0:
++ break;
+ case EINTR:
+ continue;
+ default:
+ i = iputil_srand_fallback();
+- break;
++ goto done;
+ }
+- }
++ } while (ret != sizeof(i));
++ done:
+ #else
+ i = iputil_srand_fallback();
+ #endif
diff --git a/net-misc/iputils/iputils-20200821.ebuild b/net-misc/iputils/iputils-20200821-r1.ebuild
index 035fe9df7914..3b1245c10826 100644
--- a/net-misc/iputils/iputils-20200821.ebuild
+++ b/net-misc/iputils/iputils-20200821-r1.ebuild
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# For released versions, we precompile the man/html pages and store
@@ -61,7 +61,9 @@ fi
[ "${PV}" == "99999999" ] || S="${WORKDIR}/${PN}-s${PV}"
-PATCHES=()
+PATCHES=(
+ "${FILESDIR}/iputils-20200821-getrandom-fallback.patch"
+)
src_prepare() {
default