diff options
author | Hanno Böck <hanno@gentoo.org> | 2022-11-26 18:48:25 +0100 |
---|---|---|
committer | Hanno Böck <hanno@gentoo.org> | 2022-11-26 18:48:25 +0100 |
commit | d15eae1e2a778ba92e986121ae3437e48b4b5e2b (patch) | |
tree | 7d504ff4930f9b2f615964b8fc9fa0ed1a288480 /app-text | |
parent | dev-python/python-ctags: support Py3.11, use PEP517 (diff) | |
download | gentoo-d15eae1e2a778ba92e986121ae3437e48b4b5e2b.tar.gz gentoo-d15eae1e2a778ba92e986121ae3437e48b4b5e2b.tar.bz2 gentoo-d15eae1e2a778ba92e986121ae3437e48b4b5e2b.zip |
app-text/uudeview: Fix format string and function definition issues.
This fixes two compiler warnings about possible format string risks
and missing function definitions that will cause errors in clang 16.
Closes: https://bugs.gentoo.org/521266
Closes: https://bugs.gentoo.org/874960
Closes: https://github.com/gentoo/gentoo/pull/28420
Signed-off-by: Hanno Böck <hanno@gentoo.org>
Diffstat (limited to 'app-text')
4 files changed, 212 insertions, 0 deletions
diff --git a/app-text/uudeview/files/uudeview-0.5.20-fix-function-definitions-clang16.patch b/app-text/uudeview/files/uudeview-0.5.20-fix-function-definitions-clang16.patch new file mode 100644 index 000000000000..2ed3dd572be0 --- /dev/null +++ b/app-text/uudeview/files/uudeview-0.5.20-fix-function-definitions-clang16.patch @@ -0,0 +1,134 @@ +Clang16 will not allow implicit function declaration, implicit int etc. by default. +This patch overhauls the source code to build with clan16 defaults. + +Bug: https://bugs.gentoo.org/874960 + +Original patch by Pascal Jäger <pascal.jaeger@leimstift.de>, +minor adjustments by Hanno Böck. + +diff -Naurp a/inews/clientlib.c b/inews/clientlib.c +--- a/inews/clientlib.c 1996-06-06 21:41:07.000000000 +0200 ++++ b/inews/clientlib.c 2022-11-26 18:32:09.383423565 +0100 +@@ -14,6 +14,7 @@ static char *sccsid = "@(#)clientlib.c 1 + #include "../config.h" + #endif + ++#include <arpa/inet.h> + #include <stdio.h> + #ifndef FOR_NN + #include <sys/types.h> +@@ -52,6 +53,7 @@ static char *sccsid = "@(#)clientlib.c 1 + #endif + + #include "nntp.h" ++#include "clientlib.h" + + FILE *ser_rd_fp = NULL; + FILE *ser_wr_fp = NULL; +@@ -133,7 +135,7 @@ char *file; + * for reading and writing to server. + */ + +-server_init(machine) ++int server_init(machine) + char *machine; + { + int sockt_rd, sockt_wr; +@@ -194,7 +196,7 @@ char *machine; + * Errors: Printed via perror. + */ + +-get_tcp_socket(machine) ++int get_tcp_socket(machine) + char *machine; + { + int s; +@@ -218,7 +220,6 @@ char *machine; + * fails. + */ + if( (hp = gethostbyname( machine ) ) == NULL ) { +- unsigned long inet_addr(); + static struct hostent def; + static struct in_addr defaddr; + static char *alist[1]; +@@ -344,7 +345,7 @@ char *machine; + * Errors: Printed via nerror. + */ + +-get_dnet_socket(machine) ++int get_dnet_socket(machine) + char *machine; + { + int s, area, node; +@@ -427,7 +428,7 @@ char *machine; + * Side effects: None. + */ + +-handle_server_response(response, server) ++int handle_server_response(response, server) + int response; + char *server; + { +@@ -502,7 +503,7 @@ char *string; + * Side effects: Talks to server, changes contents of "string". + */ + +-get_server(string, size) ++int get_server(string, size) + char *string; + int size; + { +diff -Naurp a/inews/clientlib.h b/inews/clientlib.h +--- a/inews/clientlib.h 1996-06-06 21:41:07.000000000 +0200 ++++ b/inews/clientlib.h 2022-11-26 18:27:59.711248861 +0100 +@@ -9,3 +9,7 @@ extern int server_init(); + extern void put_server(); + extern int get_server(); + extern void close_server(); ++ ++extern int get_tcp_socket(char *machine); ++extern int get_server(char *string, int size); ++extern int handle_server_response(int response, char *server); +diff -Naurp a/inews/inews.c b/inews/inews.c +--- a/inews/inews.c 2004-01-29 03:14:19.000000000 +0100 ++++ b/inews/inews.c 2022-11-26 18:32:26.200435328 +0100 +@@ -39,15 +39,20 @@ static char *sccsid = "@(#)inews.c 1.16 + + #include "conf.h" + #include "nntp.h" ++#include "clientlib.h" + + + #define MAX_SIGNATURE 6 + ++int strneql(char *a, char *b, int n); ++void gen_frompath(void); ++int valid_header(register char *h); ++ + extern FILE *ser_wr_fp; + + char host_name[256]; + +-main(argc, argv) ++int main(argc, argv) + int argc; + char *argv[]; + { +@@ -254,7 +259,7 @@ append_signature() + * a From: line in it. + */ + +-gen_frompath() ++void gen_frompath() + { + char *full_name; + char *cp; +@@ -330,7 +335,7 @@ gen_frompath() + * Side effects: None. + */ + +-strneql(a, b, n) ++int strneql(a, b, n) + register char *a, *b; + int n; + { diff --git a/app-text/uudeview/files/uudeview-0.5.20-format-string-warning-inews.patch b/app-text/uudeview/files/uudeview-0.5.20-format-string-warning-inews.patch new file mode 100644 index 000000000000..de53717a3cbe --- /dev/null +++ b/app-text/uudeview/files/uudeview-0.5.20-format-string-warning-inews.patch @@ -0,0 +1,11 @@ +--- a/inews/inews.c 2022-11-26 18:44:03.788039229 +0100 ++++ b/inews/inews.c 2022-11-26 18:44:47.376080190 +0100 +@@ -303,7 +303,7 @@ + putc(*cp, ser_wr_fp); + else { /* Stupid & hack. God damn it. */ + putc(toupper(passwd->pw_name[0]), ser_wr_fp); +- fprintf(ser_wr_fp, passwd->pw_name+1); ++ fprintf(ser_wr_fp, "%s", passwd->pw_name+1); + } + + fprintf(ser_wr_fp, ")\r\n"); diff --git a/app-text/uudeview/files/uudeview-0.5.20-string_format_issue.patch b/app-text/uudeview/files/uudeview-0.5.20-string_format_issue.patch new file mode 100644 index 000000000000..7cbc584f5b47 --- /dev/null +++ b/app-text/uudeview/files/uudeview-0.5.20-string_format_issue.patch @@ -0,0 +1,24 @@ +Description: Fix potential security issue (arbitrary string being passed + as a format string to fprintf). +Author: Andrew Shadura <andrewsh@debian.org> + +--- a/unix/uuenview.c ++++ b/unix/uuenview.c +@@ -310,7 +310,7 @@ SendMkCommand (char **rcptlist, char *to + } + + if ((*rcptlist = (char *) malloc (strlen (towhom) + 16)) == NULL) { +- fprintf (stderr, "error: Out of memory allocating %d bytes\n", ++ fprintf (stderr, "error: Out of memory allocating %zd bytes\n", + strlen (towhom)+16); + _FP_free (command); + return NULL; +@@ -483,7 +483,7 @@ AttachFiles (char *towhom, char *subject + if (_FP_stristr (input, "multipart") != NULL) { + /* it is already a multipart posting. grab the boundary */ + if ((ptr = _FP_stristr (input, "boundary=")) != NULL) { +- fprintf(thepipe, input); ++ fprintf(thepipe, "%s", input); + strcpy (boundary, ParseValue (ptr)); + hadmulti = 1; + } diff --git a/app-text/uudeview/uudeview-0.5.20-r3.ebuild b/app-text/uudeview/uudeview-0.5.20-r3.ebuild new file mode 100644 index 000000000000..903bd6b43754 --- /dev/null +++ b/app-text/uudeview/uudeview-0.5.20-r3.ebuild @@ -0,0 +1,43 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit autotools toolchain-funcs + +DESCRIPTION="uu, xx, base64, binhex decoder" +HOMEPAGE="http://www.fpx.de/fp/Software/UUDeview/" +SRC_URI="http://www.fpx.de/fp/Software/UUDeview/download/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos" + +PATCHES=( + "${FILESDIR}"/${P}-bugfixes.patch + "${FILESDIR}"/${P}-CVE-2004-2265.patch + "${FILESDIR}"/${P}-CVE-2008-2266.patch + "${FILESDIR}"/${P}-man.patch + "${FILESDIR}"/${P}-rename.patch + "${FILESDIR}"/${P}-makefile.patch + "${FILESDIR}"/${P}-fix-append_signature.patch + "${FILESDIR}"/${P}-string_format_issue.patch + "${FILESDIR}"/${P}-format-string-warning-inews.patch + "${FILESDIR}"/${P}-fix-function-definitions-clang16.patch +) + +DOCS=( HISTORY INSTALL README ) + +src_prepare() { + sed -i "s:^\tar r:\t$(tc-getAR) r:" uulib/Makefile.in || die + + default + mv configure.{in,ac} || die + eautoreconf +} + +src_configure() { + econf \ + --disable-tcl \ + --disable-tk +} |