Subject: kern/6402: filter out 0xffs in scsipi_strvis()
To: None <gnats-bugs@gnats.netbsd.org>
From: Soren S. Jorvang <soren@t.dk>
List: netbsd-bugs
Date: 11/06/1998 04:40:56
>Number: 6402
>Category: kern
>Synopsis: filter out 0xffs in scsipi_strvis()
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: kern-bug-people (Kernel Bug People)
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Nov 5 19:50:00 1998
>Last-Modified:
>Originator: Soren S. Jorvang
>Organization:
Soren
>Release: NetBSD-current
>Environment:
System: NetBSD 1.3H
>Description:
Apparently, some SCSI devices use 0xff in addition to NUL and SPC
for whitespace in inquiry strings.
>How-To-Repeat:
ss0 at scsibus1 targ 6 lun 0: <MUSTEK\377\377, MFS-06000CX\377\377\377\377\377, 4.05> SCSI0 6/scanner fixed
ss0 at scsibus1 targ 6 lun 0: <MUSTEK, MFS-06000CX, 4.05> SCSI0 6/scanner fixed
>Fix:
--- src/sys/dev/scsipi/scsipiconf.c.orig Fri Nov 6 03:03:20 1998
+++ src/sys/dev/scsipi/scsipiconf.c Fri Nov 6 03:32:03 1998
@@ -177,11 +177,12 @@
u_char *dst, *src;
int dlen, slen;
{
-
- /* Trim leading and trailing blanks and NULs. */
- while (slen > 0 && (src[0] == ' ' || src[0] == '\0'))
+ /* Trim leading and trailing blanks, NULs and 0xffs. */
+ while (slen > 0 && (src[0] == ' ' || src[0] == '\0' ||
+ src[0] == (u_char)'\377'))
++src, --slen;
- while (slen > 0 && (src[slen-1] == ' ' || src[slen-1] == '\0'))
+ while (slen > 0 && (src[slen-1] == ' ' || src[slen-1] == '\0' ||
+ src[slen-1] == (u_char)'\377'))
--slen;
while (slen > 0) {
>Audit-Trail:
>Unformatted: