Gentoo Archives: gentoo-commits

From: "Hanno Böck" <hanno@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-text/uudeview/files/, app-text/uudeview/
Date: Sat, 26 Nov 2022 17:50:31
Message-Id: 1669484905.d15eae1e2a778ba92e986121ae3437e48b4b5e2b.hanno@gentoo
1 commit: d15eae1e2a778ba92e986121ae3437e48b4b5e2b
2 Author: Hanno Böck <hanno <AT> gentoo <DOT> org>
3 AuthorDate: Sat Nov 26 17:48:25 2022 +0000
4 Commit: Hanno Böck <hanno <AT> gentoo <DOT> org>
5 CommitDate: Sat Nov 26 17:48:25 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d15eae1e
7
8 app-text/uudeview: Fix format string and function definition issues.
9
10 This fixes two compiler warnings about possible format string risks
11 and missing function definitions that will cause errors in clang 16.
12
13 Closes: https://bugs.gentoo.org/521266
14 Closes: https://bugs.gentoo.org/874960
15 Closes: https://github.com/gentoo/gentoo/pull/28420
16 Signed-off-by: Hanno Böck <hanno <AT> gentoo.org>
17
18 ...w-0.5.20-fix-function-definitions-clang16.patch | 134 +++++++++++++++++++++
19 ...deview-0.5.20-format-string-warning-inews.patch | 11 ++
20 .../uudeview-0.5.20-string_format_issue.patch | 24 ++++
21 app-text/uudeview/uudeview-0.5.20-r3.ebuild | 43 +++++++
22 4 files changed, 212 insertions(+)
23
24 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
25 new file mode 100644
26 index 000000000000..2ed3dd572be0
27 --- /dev/null
28 +++ b/app-text/uudeview/files/uudeview-0.5.20-fix-function-definitions-clang16.patch
29 @@ -0,0 +1,134 @@
30 +Clang16 will not allow implicit function declaration, implicit int etc. by default.
31 +This patch overhauls the source code to build with clan16 defaults.
32 +
33 +Bug: https://bugs.gentoo.org/874960
34 +
35 +Original patch by Pascal Jäger <pascal.jaeger@×××××××××.de>,
36 +minor adjustments by Hanno Böck.
37 +
38 +diff -Naurp a/inews/clientlib.c b/inews/clientlib.c
39 +--- a/inews/clientlib.c 1996-06-06 21:41:07.000000000 +0200
40 ++++ b/inews/clientlib.c 2022-11-26 18:32:09.383423565 +0100
41 +@@ -14,6 +14,7 @@ static char *sccsid = "@(#)clientlib.c 1
42 + #include "../config.h"
43 + #endif
44 +
45 ++#include <arpa/inet.h>
46 + #include <stdio.h>
47 + #ifndef FOR_NN
48 + #include <sys/types.h>
49 +@@ -52,6 +53,7 @@ static char *sccsid = "@(#)clientlib.c 1
50 + #endif
51 +
52 + #include "nntp.h"
53 ++#include "clientlib.h"
54 +
55 + FILE *ser_rd_fp = NULL;
56 + FILE *ser_wr_fp = NULL;
57 +@@ -133,7 +135,7 @@ char *file;
58 + * for reading and writing to server.
59 + */
60 +
61 +-server_init(machine)
62 ++int server_init(machine)
63 + char *machine;
64 + {
65 + int sockt_rd, sockt_wr;
66 +@@ -194,7 +196,7 @@ char *machine;
67 + * Errors: Printed via perror.
68 + */
69 +
70 +-get_tcp_socket(machine)
71 ++int get_tcp_socket(machine)
72 + char *machine;
73 + {
74 + int s;
75 +@@ -218,7 +220,6 @@ char *machine;
76 + * fails.
77 + */
78 + if( (hp = gethostbyname( machine ) ) == NULL ) {
79 +- unsigned long inet_addr();
80 + static struct hostent def;
81 + static struct in_addr defaddr;
82 + static char *alist[1];
83 +@@ -344,7 +345,7 @@ char *machine;
84 + * Errors: Printed via nerror.
85 + */
86 +
87 +-get_dnet_socket(machine)
88 ++int get_dnet_socket(machine)
89 + char *machine;
90 + {
91 + int s, area, node;
92 +@@ -427,7 +428,7 @@ char *machine;
93 + * Side effects: None.
94 + */
95 +
96 +-handle_server_response(response, server)
97 ++int handle_server_response(response, server)
98 + int response;
99 + char *server;
100 + {
101 +@@ -502,7 +503,7 @@ char *string;
102 + * Side effects: Talks to server, changes contents of "string".
103 + */
104 +
105 +-get_server(string, size)
106 ++int get_server(string, size)
107 + char *string;
108 + int size;
109 + {
110 +diff -Naurp a/inews/clientlib.h b/inews/clientlib.h
111 +--- a/inews/clientlib.h 1996-06-06 21:41:07.000000000 +0200
112 ++++ b/inews/clientlib.h 2022-11-26 18:27:59.711248861 +0100
113 +@@ -9,3 +9,7 @@ extern int server_init();
114 + extern void put_server();
115 + extern int get_server();
116 + extern void close_server();
117 ++
118 ++extern int get_tcp_socket(char *machine);
119 ++extern int get_server(char *string, int size);
120 ++extern int handle_server_response(int response, char *server);
121 +diff -Naurp a/inews/inews.c b/inews/inews.c
122 +--- a/inews/inews.c 2004-01-29 03:14:19.000000000 +0100
123 ++++ b/inews/inews.c 2022-11-26 18:32:26.200435328 +0100
124 +@@ -39,15 +39,20 @@ static char *sccsid = "@(#)inews.c 1.16
125 +
126 + #include "conf.h"
127 + #include "nntp.h"
128 ++#include "clientlib.h"
129 +
130 +
131 + #define MAX_SIGNATURE 6
132 +
133 ++int strneql(char *a, char *b, int n);
134 ++void gen_frompath(void);
135 ++int valid_header(register char *h);
136 ++
137 + extern FILE *ser_wr_fp;
138 +
139 + char host_name[256];
140 +
141 +-main(argc, argv)
142 ++int main(argc, argv)
143 + int argc;
144 + char *argv[];
145 + {
146 +@@ -254,7 +259,7 @@ append_signature()
147 + * a From: line in it.
148 + */
149 +
150 +-gen_frompath()
151 ++void gen_frompath()
152 + {
153 + char *full_name;
154 + char *cp;
155 +@@ -330,7 +335,7 @@ gen_frompath()
156 + * Side effects: None.
157 + */
158 +
159 +-strneql(a, b, n)
160 ++int strneql(a, b, n)
161 + register char *a, *b;
162 + int n;
163 + {
164
165 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
166 new file mode 100644
167 index 000000000000..de53717a3cbe
168 --- /dev/null
169 +++ b/app-text/uudeview/files/uudeview-0.5.20-format-string-warning-inews.patch
170 @@ -0,0 +1,11 @@
171 +--- a/inews/inews.c 2022-11-26 18:44:03.788039229 +0100
172 ++++ b/inews/inews.c 2022-11-26 18:44:47.376080190 +0100
173 +@@ -303,7 +303,7 @@
174 + putc(*cp, ser_wr_fp);
175 + else { /* Stupid & hack. God damn it. */
176 + putc(toupper(passwd->pw_name[0]), ser_wr_fp);
177 +- fprintf(ser_wr_fp, passwd->pw_name+1);
178 ++ fprintf(ser_wr_fp, "%s", passwd->pw_name+1);
179 + }
180 +
181 + fprintf(ser_wr_fp, ")\r\n");
182
183 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
184 new file mode 100644
185 index 000000000000..7cbc584f5b47
186 --- /dev/null
187 +++ b/app-text/uudeview/files/uudeview-0.5.20-string_format_issue.patch
188 @@ -0,0 +1,24 @@
189 +Description: Fix potential security issue (arbitrary string being passed
190 + as a format string to fprintf).
191 +Author: Andrew Shadura <andrewsh@××××××.org>
192 +
193 +--- a/unix/uuenview.c
194 ++++ b/unix/uuenview.c
195 +@@ -310,7 +310,7 @@ SendMkCommand (char **rcptlist, char *to
196 + }
197 +
198 + if ((*rcptlist = (char *) malloc (strlen (towhom) + 16)) == NULL) {
199 +- fprintf (stderr, "error: Out of memory allocating %d bytes\n",
200 ++ fprintf (stderr, "error: Out of memory allocating %zd bytes\n",
201 + strlen (towhom)+16);
202 + _FP_free (command);
203 + return NULL;
204 +@@ -483,7 +483,7 @@ AttachFiles (char *towhom, char *subject
205 + if (_FP_stristr (input, "multipart") != NULL) {
206 + /* it is already a multipart posting. grab the boundary */
207 + if ((ptr = _FP_stristr (input, "boundary=")) != NULL) {
208 +- fprintf(thepipe, input);
209 ++ fprintf(thepipe, "%s", input);
210 + strcpy (boundary, ParseValue (ptr));
211 + hadmulti = 1;
212 + }
213
214 diff --git a/app-text/uudeview/uudeview-0.5.20-r3.ebuild b/app-text/uudeview/uudeview-0.5.20-r3.ebuild
215 new file mode 100644
216 index 000000000000..903bd6b43754
217 --- /dev/null
218 +++ b/app-text/uudeview/uudeview-0.5.20-r3.ebuild
219 @@ -0,0 +1,43 @@
220 +# Copyright 1999-2022 Gentoo Authors
221 +# Distributed under the terms of the GNU General Public License v2
222 +
223 +EAPI=8
224 +
225 +inherit autotools toolchain-funcs
226 +
227 +DESCRIPTION="uu, xx, base64, binhex decoder"
228 +HOMEPAGE="http://www.fpx.de/fp/Software/UUDeview/"
229 +SRC_URI="http://www.fpx.de/fp/Software/UUDeview/download/${P}.tar.gz"
230 +
231 +LICENSE="GPL-2"
232 +SLOT="0"
233 +KEYWORDS="~alpha ~amd64 ~ppc ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos"
234 +
235 +PATCHES=(
236 + "${FILESDIR}"/${P}-bugfixes.patch
237 + "${FILESDIR}"/${P}-CVE-2004-2265.patch
238 + "${FILESDIR}"/${P}-CVE-2008-2266.patch
239 + "${FILESDIR}"/${P}-man.patch
240 + "${FILESDIR}"/${P}-rename.patch
241 + "${FILESDIR}"/${P}-makefile.patch
242 + "${FILESDIR}"/${P}-fix-append_signature.patch
243 + "${FILESDIR}"/${P}-string_format_issue.patch
244 + "${FILESDIR}"/${P}-format-string-warning-inews.patch
245 + "${FILESDIR}"/${P}-fix-function-definitions-clang16.patch
246 +)
247 +
248 +DOCS=( HISTORY INSTALL README )
249 +
250 +src_prepare() {
251 + sed -i "s:^\tar r:\t$(tc-getAR) r:" uulib/Makefile.in || die
252 +
253 + default
254 + mv configure.{in,ac} || die
255 + eautoreconf
256 +}
257 +
258 +src_configure() {
259 + econf \
260 + --disable-tcl \
261 + --disable-tk
262 +}