Subject: pkg/16759: Fix for misc/linuxls --color options
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kain@unixbrewers.org>
List: netbsd-bugs
Date: 05/11/2002 13:36:11
>Number: 16759
>Category: pkg
>Synopsis: linuxls will segfault if --color is given an invalid option
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sat May 11 10:37:00 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:
>Release: NetBSD 1.5.2
>Organization:
>Environment:
System: NetBSD ipa.unixbrewers.org 1.5.2 NetBSD 1.5.2 (HOPHEAD) #11: Thu Mar 14 11:15:49 EST 2002 kain@ipa.unixbrewers.org:/home/kain/source/sack-kernel/arch/i386/compile/HOPHEAD i386
>Description:
The color-ls patch applied to fileutils for the linuxls package contains
an array of strings called color_args. A check is made in a for loop
that checks for color_args[i] to terminate the loop and color_args has
no terminating value. The loop walks off the end of the array and tries
to strncmp an invalid address causing a segmentation fault when an invalid
option (ie one not in color_args) is passed to the --color option of linuxls.
>How-To-Repeat:
Try running linuxls with an invalid option:
linuxls --color=auto
This was found and pointed out by Julio Merino on current-users.
>Fix:
Add a NULL value at the end of color_args[] in ls.c
A patch for the package:
(Note, I have to patch -p0 < patchfile from pkgsrc/misc to get it to create
linuxls/patches/patch-ab. I'm kind of lame with diff/patch)
diff -ruN linuxls.orig/distinfo linuxls/distinfo
--- linuxls.orig/distinfo Sat May 11 13:21:31 2002
+++ linuxls/distinfo Sat May 11 13:22:54 2002
@@ -5,3 +5,4 @@
SHA1 (color-ls-3.12.0.2.patch.gz) = 37d30c5852e67781103730b291bdadc5c6c0e16d
Size (color-ls-3.12.0.2.patch.gz) = 20884 bytes
SHA1 (patch-aa) = bd2b88265b91c033f62da17c3cced3cf117b5318
+SHA1 (patch-ab) = 7c86e69bf6ed6f44f2e4859e908a72bc0bf12b90
diff -ruN linuxls.orig/patches/patch-ab linuxls/patches/patch-ab
--- linuxls.orig/patches/patch-ab Wed Dec 31 19:00:00 1969
+++ linuxls/patches/patch-ab Sat May 11 13:22:17 2002
@@ -0,0 +1,11 @@
+--- src/ls.c.orig Sat May 11 13:01:03 2002
++++ src/ls.c Sat May 11 13:01:09 2002
+@@ -600,7 +600,7 @@
+ {
+ /* Note: "no" is a prefix of "none" so we don't include it */
+ /* force and none are for compatibility with another color-ls version */
+- "yes", "force", "none", "tty", "if-tty"
++ "yes", "force", "none", "tty", "if-tty", NULL
+ };
+
+ static enum color_type const color_types[] =
>Release-Note:
>Audit-Trail:
>Unformatted: