diff --git a/epiphany-fix-compile-warning.patch b/epiphany-fix-compile-warning.patch new file mode 100644 index 0000000..2fe5ef8 --- /dev/null +++ b/epiphany-fix-compile-warning.patch @@ -0,0 +1,68 @@ +From 929f8f4d9e89c7751e6a6f15c1915349a2851c97 Mon Sep 17 00:00:00 2001 +From: Michael Catanzaro +Date: Wed, 22 Jan 2020 16:11:58 -0600 +Subject: [PATCH] sync-utils: use getrandom() to generate randomness + +GCC complains that we ignore the return value from fread(), which is +important for error checking. + +This is easy to fix, but might as well switch to getrandom() while we're +at it, since this is the nice/modern way to get randomness. + +Note: requires glibc 2.25 or a newish FreeBSD. +--- + lib/ephy-sync-utils.c | 15 ++++++++++----- + 1 file changed, 10 insertions(+), 5 deletions(-) + +diff --git a/lib/ephy-sync-utils.c b/lib/ephy-sync-utils.c +index 6c8a37a85..4ae56220b 100644 +--- a/lib/ephy-sync-utils.c ++++ b/lib/ephy-sync-utils.c +@@ -23,12 +23,14 @@ + + #include "ephy-settings.h" + ++#include + #include + #include + #include + #include + #include + #include ++#include + + static const char hex_digits[] = "0123456789abcdef"; + +@@ -165,21 +167,24 @@ ephy_sync_utils_base64_urlsafe_decode (const char *text, + * This is mainly required by Nettle's RSA support. + * From Nettle's documentation: random_ctx and random is a randomness generator. + * random(random_ctx, length, dst) should generate length random octets and store them at dst. +- * We don't really use random_ctx, since we have /dev/urandom available. ++ * We don't use random_ctx. + */ + void + ephy_sync_utils_generate_random_bytes (void *random_ctx, + gsize num_bytes, + guint8 *out) + { +- FILE *fp; ++ gssize ret; + + g_assert (num_bytes > 0); + g_assert (out); + +- fp = fopen ("/dev/urandom", "r"); +- fread (out, sizeof (guint8), num_bytes, fp); +- fclose (fp); ++ do { ++ ret = getrandom (out, num_bytes, 0); ++ } while (ret < (gssize)num_bytes && errno == EINTR); ++ ++ if (ret != (gssize)num_bytes) ++ g_error ("Failed to generate randomness: %s", g_strerror (errno)); + } + + char * +-- +2.24.1 + diff --git a/epiphany.changes b/epiphany.changes index 16fa83d..d11d2e5 100644 --- a/epiphany.changes +++ b/epiphany.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Thu Jan 23 09:48:38 UTC 2020 - Bjørn Lie + +- Add backported patch from upstream: + epiphany-fix-compile-warning.patch: sync-utils: use getrandom() + to generate randomness. +- Drop epiphany-lang Recommends: No longer needed, lang + supplements will take care of it. + ------------------------------------------------------------------- Sun Jan 5 12:59:49 UTC 2020 - Bjørn Lie diff --git a/epiphany.spec b/epiphany.spec index a588814..8e4559b 100644 --- a/epiphany.spec +++ b/epiphany.spec @@ -25,6 +25,8 @@ Group: Productivity/Networking/Web/Browsers URL: https://wiki.gnome.org/Apps/Web Source0: https://download.gnome.org/sources/epiphany/3.34/%{name}-%{version}.tar.xz Source99: %{name}-rpmlintrc +# PATCH-FIX-UPSTREAM epiphany-fix-compile-warning.patch -- sync-utils: use getrandom() to generate randomness +Patch0: epiphany-fix-compile-warning.patch BuildRequires: fdupes BuildRequires: meson >= 0.42.0 @@ -58,7 +60,6 @@ BuildRequires: pkgconfig(webkit2gtk-4.0) >= 2.25.1 BuildRequires: pkgconfig(webkit2gtk-web-extension-4.0) >= 2.25.1 Requires: %{name}-branding = %{version} Requires: iso-codes -Recommends: %{name}-lang Recommends: ca-certificates %description