Gentoo Archives: gentoo-commits

From: Lars Wendler <polynomial-c@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-process/procps/files/, sys-process/procps/
Date: Fri, 06 Mar 2020 12:36:29
Message-Id: 1583498174.d832efe0225a524ed86bab423bf90cef980a6480.polynomial-c@gentoo
1 commit: d832efe0225a524ed86bab423bf90cef980a6480
2 Author: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
3 AuthorDate: Fri Mar 6 12:35:45 2020 +0000
4 Commit: Lars Wendler <polynomial-c <AT> gentoo <DOT> org>
5 CommitDate: Fri Mar 6 12:36:14 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d832efe0
7
8 sys-process/procps: Revbump for toprc backwards compatibility
9
10 Thanks-to: Massimo Burcheri <burcheri.massimo+bugs-gentoo <AT> gmail.com>
11 Closes: https://bugs.gentoo.org/711676
12 Package-Manager: Portage-2.3.92, Repoman-2.3.20
13 Signed-off-by: Lars Wendler <polynomial-c <AT> gentoo.org>
14
15 ...ocps-3.3.16-toprc_backwards_compatibility.patch | 71 ++++++++++++++++++++++
16 ...ps-3.3.16-r1.ebuild => procps-3.3.16-r2.ebuild} | 1 +
17 2 files changed, 72 insertions(+)
18
19 diff --git a/sys-process/procps/files/procps-3.3.16-toprc_backwards_compatibility.patch b/sys-process/procps/files/procps-3.3.16-toprc_backwards_compatibility.patch
20 new file mode 100644
21 index 00000000000..19721205dfe
22 --- /dev/null
23 +++ b/sys-process/procps/files/procps-3.3.16-toprc_backwards_compatibility.patch
24 @@ -0,0 +1,71 @@
25 +From 5cd29e5093efa3c6ee9c5310b64347f1d54b707d Mon Sep 17 00:00:00 2001
26 +From: Jim Warner <james.warner@×××××××.net>
27 +Date: Sat, 15 Feb 2020 00:00:00 -0600
28 +Subject: [PATCH] top: restore configuration file backward compatibility
29 +
30 +The Debian bug referenced below has nothing to do with
31 +locales. In fact, top was made locale independent back
32 +in release 3.3.13 (April, 2018). However, that bug did
33 +reveal some misplaced logic which this patch corrects.
34 +
35 +Prompted by the Qualys audit, all rcfile field strings
36 +were checked for potential duplicates which could only
37 +have resulted from some user's manual/malicious edits.
38 +
39 +Unfortunately, that code was executed before top had a
40 +chance to enforce the proper/maximum string length (in
41 +the event an extremely old rcfile had just been read).
42 +This created some potential string overrun references.
43 +
44 +In top's original 3.3.15 implementation, the potential
45 +overrun extended for 15 characters. That is the number
46 +of field characters added with 3.3.9 (December, 2013).
47 +But, since strchr() was used, no error exit was taken.
48 +
49 +In the revised 3.3.16 implementation, the strchr() was
50 +replaced with '&w->rc.fieldscur[n]'. This held overrun
51 +to a single position while producing an error message.
52 +
53 +So, this commit just moves that logic to a point where
54 +fieldscur is guaranteed to be longer than EU_MAXPFLGS.
55 +
56 +Reference(s):
57 +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951335
58 +. revised 3.3.16 validation logic
59 +commit 291d98ee5036567f93d21bc11142b0a7e2ee70ae
60 +. original 3.3.15 validation logic
61 +commit fdb58974e24c025a1f866f324c62f1d8f96234f8
62 +
63 +Signed-off-by: Jim Warner <james.warner@×××××××.net>
64 +---
65 +diff --git a/top/top.c b/top/top.c
66 +index 63ec5fe..b4fe21e 100644
67 +--- a/top/top.c
68 ++++ b/top/top.c
69 +@@ -3939,11 +3939,6 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) {
70 + // too bad fscanf is not as flexible with his format string as snprintf
71 + #error Hey, fix the above fscanf 'PFLAGSSIZ' dependency !
72 + #endif
73 +- // ensure there's been no manual alteration of fieldscur
74 +- for (n = 0 ; n < EU_MAXPFLGS; n++) {
75 +- if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n]))
76 +- return p;
77 +- }
78 + // be tolerant of missing release 3.3.10 graph modes additions
79 + if (3 > fscanf(fp, "\twinflags=%d, sortindx=%d, maxtasks=%d, graph_cpus=%d, graph_mems=%d\n"
80 + , &w->rc.winflags, &w->rc.sortindx, &w->rc.maxtasks, &w->rc.graph_cpus, &w->rc.graph_mems))
81 +@@ -3989,6 +3984,11 @@ static const char *configs_file (FILE *fp, const char *name, float *delay) {
82 + return p;
83 + break;
84 + }
85 ++ // ensure there's been no manual alteration of fieldscur
86 ++ for (n = 0 ; n < EU_MAXPFLGS; n++) {
87 ++ if (&w->rc.fieldscur[n] != strrchr(w->rc.fieldscur, w->rc.fieldscur[n]))
88 ++ return p;
89 ++ }
90 + #ifndef USE_X_COLHDR
91 + OFFw(w, NOHIFND_xxx | NOHISEL_xxx);
92 + #endif
93 +--
94 +2.24.1
95 +
96
97 diff --git a/sys-process/procps/procps-3.3.16-r1.ebuild b/sys-process/procps/procps-3.3.16-r2.ebuild
98 similarity index 97%
99 rename from sys-process/procps/procps-3.3.16-r1.ebuild
100 rename to sys-process/procps/procps-3.3.16-r2.ebuild
101 index b7c8b18e232..8a5e2ae740e 100644
102 --- a/sys-process/procps/procps-3.3.16-r1.ebuild
103 +++ b/sys-process/procps/procps-3.3.16-r2.ebuild
104 @@ -43,6 +43,7 @@ PATCHES=(
105 "${FILESDIR}"/${PN}-3.3.12-proc-tests.patch # 583036
106
107 # Upstream fixes
108 + "${FILESDIR}"/${P}-toprc_backwards_compatibility.patch #711676
109 )
110
111 multilib_src_configure() {