Hi,

There are 2 problems with xtermset:

- EOF is not properly checked on unsigned char archs while loading and
  storing the configuration file
- There is a boundary error while saving the configuration file,
  leading to a segfault that i can't reproduce on amd64

These problems vanish with the below diff, the runtime is fine on amd64
and macppc. While here i have removed a trailing whitespace in the
Makefile.

Comments/feedback are welcome,

Charlène.


Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/xtermset/Makefile,v
retrieving revision 1.19
diff -u -p -u -p -r1.19 Makefile
--- Makefile    12 Jul 2019 21:02:30 -0000      1.19
+++ Makefile    12 Oct 2020 06:01:44 -0000
@@ -3,13 +3,13 @@
 COMMENT=       dynamically change some settings of an xterm
 
 DISTNAME=      xtermset-0.5.2
-REVISION=      2
+REVISION=      3
 CATEGORIES=    x11
 
 # GPL
 PERMIT_PACKAGE=        Yes
 
-WANTLIB=               c 
+WANTLIB=               c
 
 MASTER_SITES=  ${MASTER_SITE_SOURCEFORGE:=clts/}
 
Index: patches/patch-src_term_c
===================================================================
RCS file: patches/patch-src_term_c
diff -N patches/patch-src_term_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_term_c    12 Oct 2020 06:01:44 -0000
@@ -0,0 +1,17 @@
+$OpenBSD$
+
+Be sure we hit EOF while loading the configuration file on archs where char is
+unsigned (ppc, arm)
+
+Index: src/term.c
+--- src/term.c.orig
++++ src/term.c
+@@ -116,7 +116,7 @@ void term_loadall() {
+    good_term *n;
+    char line[MAXTERMCHARS+3];
+    int i,j=0,l,t=0;
+-   char c;
++   int c;
+ 
+    fp = fopen(TERMSDIR "/" TERMSFILE,"r");
+ 
Index: patches/patch-src_xtermset_c
===================================================================
RCS file: patches/patch-src_xtermset_c
diff -N patches/patch-src_xtermset_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_xtermset_c        12 Oct 2020 06:01:44 -0000
@@ -0,0 +1,20 @@
+$OpenBSD$
+
+Fix a boundary error that caused a segfault while storing the configuration
+file, also ensure EOF is properly matched on archs where char is unsigned (ppc,
+arm)
+
+Index: src/xtermset.c
+--- src/xtermset.c.orig
++++ src/xtermset.c
+@@ -33,8 +33,8 @@
+ 
+ int main(int argc, char *argv[])
+ {
+-    int i,style,code,switches[2];
+-    char fn[2][MAXFNCHARS-1],c,*tok;
++    int i,c,style,code,switches[3];
++    char fn[3][MAXFNCHARS-1],*tok;
+     char line[MAXOPTCHARS+10]; /* ? */
+     FILE *rcfile=NULL;
+     argument *argptr = NULL;

Reply via email to