Re: [RFC] Sanitize INQUIRY vendor, product and revision strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Rumor has it that on Mon, Aug 14, 2006 at 11:07:31AM -0600 Matthew Wilcox said:
> On Mon, Aug 14, 2006 at 12:34:56PM -0400, Alan Stern wrote:
> > Does anyone object to the patch below?  It would help at least one person; 
> > I'm concerned that it might cause trouble somewhere else.
> 
> > @@ -526,6 +519,12 @@ static int scsi_probe_lun(struct scsi_de
> >  		if (response_len > 255)
> >  			response_len = first_inquiry_len;	/* sanity */
> >  
> > +		/* Sanitize the Vendor, Product, and Revision fields. */
> > +		for (i = 8; i < 36; ++i) {
> > +			if (inq_result[i] < 0x20 || inq_result[i] > 0x7e)
> > +				inq_result[i] = ' ';
> > +		}
> > +
> >  		/*
> 
> If we have one non-printable character, should we not overwrite all
> subsequent characters with spaces?  I'm concerned that they may
> NUL-terminate a string, then the remnants be garbage.  

I wouldn't make an exception for NUL. Trying to guess that the device 
vendor really meant to NUL-terminate does not seem right to me. 
Plus it will hide out of spec devices more than "spacing" unprintable 
characters.

...

> This of course begs the questions:
>  - Do we want to mangle the inquiry return like this?
>  - Should we simply copy out the strings from the raw inquiry result, and
>    fix them at copy time

This is probably better, at the expense of some space though. 


FWIW,


Phil



-- 
Philip R. Auld, Ph.D.  	        	       Egenera, Inc.    
Software Architect                            165 Forest St.
(508) 858-2628                            Marlboro, MA 01752
-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux