Subject: bin/11556: wiconfig prints binary keys as text
To: None <gnats-bugs@gnats.netbsd.org>
From: None <eramore@era-t.ericsson.se>
List: netbsd-bugs
Date: 11/24/2000 01:35:13
>Number:         11556
>Category:       bin
>Synopsis:       wiconfig prints binary keys as text
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Nov 24 01:35:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Michael Eriksson
>Release:        1.5 and -current
>Organization:
Ericsson Radio Systems AB
>Environment:
System: NetBSD kafka 1.5_BETA NetBSD 1.5_BETA (KAFKA) #0: Mon Oct 23 12:16:38 CEST 2000 mer@kafka:/usr/src/sys/arch/i386/compile/KAFKA i386


>Description:

wiconfig (sometimes) prints binary keys (i.e., keys with the
high-order bit set) as a text string rather than a hexadecimal value.

>How-To-Repeat:

Set a binary key, and use ``wiconfig wi0'' to print the keys. With
some probability (depending on what is in unrelated regions of
memory), the key will be printed as text.

>Fix:

The problem is a bogus call to isprint(), which makes it look outside
its array (on architectures with signed chars). The patch below fixes
the bug.

Index: wiconfig.c
===================================================================
RCS file: /cvsroot/basesrc/usr.sbin/wiconfig/wiconfig.c,v
retrieving revision 1.5.4.2
diff -u -r1.5.4.2 wiconfig.c
--- wiconfig.c	2000/08/07 01:11:28	1.5.4.2
+++ wiconfig.c	2000/11/24 09:13:37
@@ -359,7 +359,7 @@
                 k = &keys->wi_keys[i];
                 ptr = (char *)k->wi_keydat;
                 for (j = 0; j < k->wi_keylen; j++) {
-		        if (!isprint(ptr[j])) {
+		        if (!isprint((unsigned char) ptr[j])) {
 			        bn = 1;
 				break;
 			}
>Release-Note:
>Audit-Trail:
>Unformatted: