summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-06-27 10:51:52 +0100
committerSam James <sam@gentoo.org>2022-06-27 10:55:12 +0100
commitaa345dbbb71bacc44c46c978c26d969539f52e03 (patch)
tree8dff3af2d60b5887e69dd83b4c6bcbb6b6d8668f
parentdev-python/pyenchant: Remove old (diff)
downloadgentoo-aa345dbbb71bacc44c46c978c26d969539f52e03.tar.gz
gentoo-aa345dbbb71bacc44c46c978c26d969539f52e03.tar.bz2
gentoo-aa345dbbb71bacc44c46c978c26d969539f52e03.zip
dev-util/cunit: fix -Wformat-security
Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--dev-util/cunit/cunit-2.1_p3-r1.ebuild61
-rw-r--r--dev-util/cunit/files/cunit-2.1_p3-ncurses-format-security.patch51
2 files changed, 112 insertions, 0 deletions
diff --git a/dev-util/cunit/cunit-2.1_p3-r1.ebuild b/dev-util/cunit/cunit-2.1_p3-r1.ebuild
new file mode 100644
index 000000000000..1c4e3118cc87
--- /dev/null
+++ b/dev-util/cunit/cunit-2.1_p3-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools flag-o-matic multilib-minimal toolchain-funcs
+
+MY_PN="CUnit"
+MY_PV="${PV/_p*}-3"
+MY_P="${MY_PN}-${MY_PV}"
+
+DESCRIPTION="C Unit Test Framework"
+HOMEPAGE="http://cunit.sourceforge.net"
+SRC_URI="mirror://sourceforge/cunit/${MY_P}.tar.bz2"
+
+LICENSE="LGPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos"
+IUSE="ncurses static-libs"
+
+RDEPEND="ncurses? ( >=sys-libs/ncurses-5.9-r3:0=[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}"/${PN}-2.1_p3-ncurses-format-security.patch
+)
+
+src_prepare() {
+ default
+
+ sed -e "/^docdir/d" -i doc/Makefile.am || die
+ sed -e '/^dochdrdir/{s:$(prefix)/doc/@PACKAGE@:$(docdir):}' \
+ -i doc/headers/Makefile.am || die
+ sed -e "s/AM_CONFIG_HEADER/AC_CONFIG_HEADERS/" -i configure.in || die
+
+ mv configure.{in,ac} || die
+ eautoreconf
+
+ append-cppflags -D_BSD_SOURCE
+
+ # unable to find headers otherwise
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ local LIBS=${LIBS}
+ append-libs $($(tc-getPKG_CONFIG) --libs ncurses)
+
+ econf \
+ $(use_enable static-libs static) \
+ --disable-debug \
+ $(use_enable ncurses curses)
+}
+
+multilib_src_install_all() {
+ einstalldocs
+ find "${D}" -name '*.la' -type f -delete || die
+}
diff --git a/dev-util/cunit/files/cunit-2.1_p3-ncurses-format-security.patch b/dev-util/cunit/files/cunit-2.1_p3-ncurses-format-security.patch
new file mode 100644
index 000000000000..5403d9dc7dbb
--- /dev/null
+++ b/dev-util/cunit/files/cunit-2.1_p3-ncurses-format-security.patch
@@ -0,0 +1,51 @@
+https://sources.debian.org/patches/cunit/2.1-3-dfsg-2.4/fix-string-format-errors-with-recent-ncu.patch/
+
+From: Sven Joachim <svenjoac@gmx.de>
+Date: Wed, 13 Oct 2021 19:23:18 +0200
+X-Dgit-Generated: 2.1-3-dfsg-3 74c029a14c5195c79122d44c3777a169d8cc535f
+Subject: Fix string format errors with recent ncurses
+
+
+--- a/CUnit/Sources/Curses/Curses.c
++++ b/CUnit/Sources/Curses/Curses.c
+@@ -952,11 +952,11 @@ static void show_suite_level_help(CU_pSu
+
+ snprintf(szTemp, STRING_LENGTH, _("Commands: R - run all tests in suite %s"),
+ pSuite->pName);
+- mvwprintw(details_pad.pPad, 0, 0, szTemp);
++ mvwprintw(details_pad.pPad, 0, 0, "%s", szTemp);
+ mvwprintw(details_pad.pPad, 1, 0, _(" S - Select and run a test"));
+ snprintf(szTemp, STRING_LENGTH, _(" L - List all tests registered in suite %s"),
+ pSuite->pName);
+- mvwprintw(details_pad.pPad, 2, 0, szTemp);
++ mvwprintw(details_pad.pPad, 2, 0, "%s", szTemp);
+ mvwprintw(details_pad.pPad, 3, 0, _(" A - Activate or deactivate a test (toggle)"));
+ mvwprintw(details_pad.pPad, 4, 0, _(" F - Show failures from last test run"));
+ mvwprintw(details_pad.pPad, 5, 0, _(" M - Move up to main menu"));
+@@ -1068,14 +1068,14 @@ static void list_tests(CU_pSuite pSuite)
+ }
+
+ snprintf(szTemp, STRING_LENGTH, "%s: %s", _("Suite"), pSuite->pName);
+- mvwprintw(details_pad.pPad, 0, 0, szTemp);
++ mvwprintw(details_pad.pPad, 0, 0, "%s", szTemp);
+
+ snprintf(szTemp, STRING_LENGTH,
+ "%*s %-*s%*s",
+ width[0], _("#"),
+ width[1], _("Test Name"),
+ width[2], _("Active?"));
+- mvwprintw(details_pad.pPad, 1, 0, szTemp);
++ mvwprintw(details_pad.pPad, 1, 0, "%s", szTemp);
+
+ for (i = 0, pCurTest = pSuite->pTest ;
+ NULL != pCurTest ;
+@@ -1158,7 +1158,7 @@ static STATUS curses_set_options_run(voi
+
+ snprintf(szTemp, STRING_LENGTH, _(" 1 - Inactive suites/tests treated as runtime failures %s"),
+ (CU_FALSE != CU_get_fail_on_inactive()) ? _("Yes") : _("No "));
+- mvwprintw(details_pad.pPad, 2, 0, szTemp);
++ mvwprintw(details_pad.pPad, 2, 0, "%s", szTemp);
+ refresh_details_window();
+ read_input_string(_("Enter number of option to change : "), szTemp, STRING_LENGTH);
+ option_num = atol(szTemp);
+