Skip to Content.
Sympa Menu

sm-commit - [SM-Commit] GIT changes to master grimoire by Ismael Luceno (468ada950318c68473a3935ee3b1fba43028ac2a)

sm-commit AT lists.ibiblio.org

Subject: Source Mage code commit list

List archive

Chronological Thread  
  • From: Ismael Luceno <scm AT sourcemage.org>
  • To: sm-commit AT lists.ibiblio.org
  • Subject: [SM-Commit] GIT changes to master grimoire by Ismael Luceno (468ada950318c68473a3935ee3b1fba43028ac2a)
  • Date: Fri, 14 Jul 2023 21:41:15 +0000

GIT changes to master grimoire by Ismael Luceno <ismael AT sourcemage.org>:

utils/atop/DETAILS |
1
utils/atop/HISTORY |
7
utils/atop/PRE_BUILD |
3
utils/atop/patches/0001-Fix-drawbar-mvwprintw-format-security-error.patch |
76 ++++++++++
utils/atop/patches/0001-Fix-includes-for-standard-compliance.patch |
42 +++++
5 files changed, 129 insertions(+)

New commits:
commit 468ada950318c68473a3935ee3b1fba43028ac2a
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

atop: Add format-security fix, SECURITY_LEVEL++

commit a2481e65f3c06cc29fb61d2f7267a95d0f938f6a
Author: Ismael Luceno <ismael AT sourcemage.org>
Commit: Ismael Luceno <ismael AT sourcemage.org>

atop: Fix build against musl

diff --git a/utils/atop/DETAILS b/utils/atop/DETAILS
index e13b774..e1d6de0 100755
--- a/utils/atop/DETAILS
+++ b/utils/atop/DETAILS
@@ -1,5 +1,6 @@
SPELL=atop
VERSION=2.9.0
+ SECURITY_PATCH=1

SOURCE_HASH=sha512:460e9594bedb552b8e692d2118d38c47e629f435848fa0d6f2f2d83cafcb19c5b77c419a2b9067a39251c5af2fa955f998074efa616221c010428ec07bb3acee
SOURCE=$SPELL-$VERSION.tar.gz
SOURCE_URL[0]=https://www.atoptool.nl/download/${SOURCE}
diff --git a/utils/atop/HISTORY b/utils/atop/HISTORY
index 96c3995..3029b30 100644
--- a/utils/atop/HISTORY
+++ b/utils/atop/HISTORY
@@ -1,3 +1,10 @@
+2023-07-14 Ismael Luceno <ismael AT sourcemage.org>
+ * PRE_BUILD, 0001-Fix-includes-for-standard-compliance.patch:
+ fixed build against musl
+ * 0001-Fix-drawbar-mvwprintw-format-security-error.patch:
+ added security fix
+ * DETAILS: SECURITY_PATCH++
+
2023-05-13 Pavel Vinogradov <public AT sourcemage.org>
* DETAILS: version 2.9.0
* PRE_BUILD, patches/*: deleted
diff --git a/utils/atop/PRE_BUILD b/utils/atop/PRE_BUILD
new file mode 100755
index 0000000..c230ad1
--- /dev/null
+++ b/utils/atop/PRE_BUILD
@@ -0,0 +1,3 @@
+default_pre_build &&
+cd "$SOURCE_DIRECTORY" &&
+apply_patch_dir patches
diff --git
a/utils/atop/patches/0001-Fix-drawbar-mvwprintw-format-security-error.patch
b/utils/atop/patches/0001-Fix-drawbar-mvwprintw-format-security-error.patch
new file mode 100644
index 0000000..3627f65
--- /dev/null
+++
b/utils/atop/patches/0001-Fix-drawbar-mvwprintw-format-security-error.patch
@@ -0,0 +1,76 @@
+From 957ff648436fa4a6f08ad9a8c5ea856a5f33ef5b Mon Sep 17 00:00:00 2001
+From: BlackEagle <ike.devolder AT gmail.com>
+Date: Fri, 2 Jun 2023 19:49:51 +0200
+Subject: [PATCH] Fix drawbar mvwprintw format-security error
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When building with `-Werror=format-security` there are some issues with
+the use of mvwprintw in drawbar.c
+
+```
+export CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions \
+ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \
+ -fstack-clash-protection -fcf-protection"
+
+make
+...
+cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions
-Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security
-fstack-clash-protection -fcf-protection -O2 -I. -Wall
-Wno-stringop-truncation -Wmissing-prototypes -Wmissing-declarations -c -o
drawbar.o drawbar.c
+drawbar.c: In function ‘drawevent’:
+drawbar.c:2058:9: error: format not a string literal and no format arguments
[-Werror=format-security]
+ 2058 | mvwprintw(w->win, line, column, text);
+ | ^~~~~~~~~
+drawbar.c: In function ‘headergetch’:
+drawbar.c:2108:17: error: format not a string literal and no format
arguments [-Werror=format-security]
+ 2108 | mvwprintw(headwin, 0, statcol, statusmsg);
+ | ^~~~~~~~~
+drawbar.c: In function ‘getwininput’:
+drawbar.c:2331:9: error: format not a string literal and no format arguments
[-Werror=format-security]
+ 2331 | mvwprintw(mywin, 1, 1, prompt);
+ | ^~~~~~~~~
+cc1: some warnings being treated as errors
+make: *** [<builtin>: drawbar.o] Error 1
+```
+
+By explicitly adding the format `"%s"` this error is fixed.
+
+Signed-off-by: BlackEagle <ike.devolder AT gmail.com>
+Origin: Upstream
+Upstream-Status: Accepted [https://github.com/Atoptool/atop/pull/262]
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ drawbar.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/drawbar.c b/drawbar.c
+index 659ed6a..e013c6c 100644
+--- a/drawbar.c
++++ b/drawbar.c
+@@ -2055,7 +2055,7 @@ drawevent(struct perwindow *w, int line, int column,
int color,
+
+ line -= 1;
+ wattron(w->win, A_BOLD);
+- mvwprintw(w->win, line, column, text);
++ mvwprintw(w->win, line, column, "%s", text);
+ wattroff(w->win, A_BOLD);
+
+ colorswoff(w->win, color);
+@@ -2105,7 +2105,7 @@ headergetch(time_t curtime, int nsecs, char
*statusmsg, int statuscol)
+ {
+ colorswon(headwin, statuscol);
+ wattron(headwin, A_REVERSE);
+- mvwprintw(headwin, 0, statcol, statusmsg);
++ mvwprintw(headwin, 0, statcol, "%s", statusmsg);
+ wattroff(headwin, A_REVERSE);
+ colorswoff(headwin, statuscol);
+ }
+@@ -2328,7 +2328,7 @@ getwininput(char *prompt, char *answer, int maxanswer,
char numerical)
+
+ // show the prompt
+ //
+- mvwprintw(mywin, 1, 1, prompt);
++ mvwprintw(mywin, 1, 1, "%s", prompt);
+
+ // prepare reading input
+ //
diff --git
a/utils/atop/patches/0001-Fix-includes-for-standard-compliance.patch
b/utils/atop/patches/0001-Fix-includes-for-standard-compliance.patch
new file mode 100644
index 0000000..016cfe0
--- /dev/null
+++ b/utils/atop/patches/0001-Fix-includes-for-standard-compliance.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Enno Boland <gottox AT voidlinux.org>
+Date: Fri, 14 Jul 2023 23:06:40 +0200
+Subject: [PATCH] Fix includes for standard compliance
+
+- time_t is defined by <time.h>
+- malloc is defined by <stdlib.h>
+
+Fixes build against musl libc.
+
+Co-authored-by: Duncaen <duncaen AT voidlinux.org>
+Co-authored-by: psykose <alice AT ayaya.dev>
+Origin: Apline & Void Linux
+Upstream-Status: Unknown
+[ismael AT sourcemage.org: Normalised patch and added description]
+Signed-off-by: Ismael Luceno <ismael AT sourcemage.org>
+---
+ drawbar.c | 1 +
+ procdbase.c | 2 +-
+ 2 files changed, 2 insertions(+), 1 deletion(-)
+
+--- a/procdbase.c
++++ b/procdbase.c
+@@ -39,7 +39,7 @@
+ #include <fcntl.h>
+ #include <unistd.h>
+ #include <string.h>
+-#include <malloc.h>
++#include <stdlib.h>
+
+ #include "atop.h"
+ #include "photoproc.h"
+--- a/drawbar.c
++++ b/drawbar.c
+@@ -110,6 +110,7 @@
+ #include <unistd.h>
+ #include <regex.h>
+ #include <sys/utsname.h>
++#include <time.h>
+
+ #include "atop.h"
+ #include "showgeneric.h"



  • [SM-Commit] GIT changes to master grimoire by Ismael Luceno (468ada950318c68473a3935ee3b1fba43028ac2a), Ismael Luceno, 07/14/2023

Archive powered by MHonArc 2.6.24.

Top of Page