diff --git a/0040-Fix-segfault-with-missing-lockfile-directory.patch b/0040-Fix-segfault-with-missing-lockfile-directory.patch new file mode 100644 index 0000000..084b879 --- /dev/null +++ b/0040-Fix-segfault-with-missing-lockfile-directory.patch @@ -0,0 +1,40 @@ +From 97a7193e1838da9ab9631d07f6b3cedf63a5995d Mon Sep 17 00:00:00 2001 +From: Phil Sutter +Date: Tue, 9 Apr 2019 14:21:25 +0200 +Subject: [PATCH] Fix segfault with missing lockfile directory + +Apparently, dirname() modifies the buffer passed to it. Given a +read-only location, this leads to a segfault. Use a buffer initialized +(and tailored) to the content of LOCKFILE macro at compile-time instead. + +Fixes: f45756c1ca3b5 ("Allow customizing lockfile location at configure time") +Signed-off-by: Phil Sutter +Signed-off-by: Florian Westphal +(cherry picked from commit c9348e18f3cdd52a7cb1586e03a55cefac08d849) +Signed-off-by: Phil Sutter +--- + libebtc.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/libebtc.c b/libebtc.c +index f2a2b500ea751..2a9ab87ac99c0 100644 +--- a/libebtc.c ++++ b/libebtc.c +@@ -140,12 +140,13 @@ int use_lockfd; + * or -2 on any other error. */ + static int lock_file() + { ++ char pathbuf[] = LOCKFILE; + int fd, try = 0; + + retry: + fd = open(LOCKFILE, O_CREAT, 00600); + if (fd < 0) { +- if (try == 1 || mkdir(dirname(LOCKFILE), 00700)) ++ if (try == 1 || mkdir(dirname(pathbuf), 00700)) + return -2; + try = 1; + goto retry; +-- +2.21.0 + diff --git a/ebtables.spec b/ebtables.spec index 967eac5..eb96156 100644 --- a/ebtables.spec +++ b/ebtables.spec @@ -3,7 +3,7 @@ Name: ebtables Version: 2.0.10 -Release: 35%{?dist} +Release: 36%{?dist} Summary: Ethernet Bridge frame table administration tool License: GPLv2+ URL: http://ebtables.sourceforge.net/ @@ -53,6 +53,7 @@ Patch36: 0036-Adjust-.gitignore-to-renamed-files.patch Patch37: 0037-extensions-Drop-Makefile.patch Patch38: 0038-Allow-customizing-lockfile-location-at-configure-tim.patch Patch39: 0039-extensions-Add-AUDIT-target.patch +Patch40: 0040-Fix-segfault-with-missing-lockfile-directory.patch BuildRequires: autogen BuildRequires: autoconf @@ -216,6 +217,9 @@ manpfx=%{_mandir}/man8/ebtables %files compat %changelog +* Wed Jun 26 2019 Phil Sutter - 2.0.10-36 +- Fix segfault with non-existing lock directory + * Wed Apr 24 2019 Phil Sutter - 2.0.10-35 - Workaround missing broute table support in ebtables-nft