Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 6 Apr 2020 18:42:01 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r359662 - head/sys/cam/scsi
Message-ID:  <202004061842.036Ig1Ga039962@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Apr  6 18:42:01 2020
New Revision: 359662
URL: https://svnweb.freebsd.org/changeset/base/359662

Log:
  Relax too strict SES element descriptors check in r355430.
  
  SES specifications allows the string to be NULL-terminated, while previous
  code was considering it as invalid due to incorrectly ordered conditions.
  
  MFC after:	 1 week
  Sponsored by:	iXsystem, Inc.

Modified:
  head/sys/cam/scsi/scsi_enc_ses.c

Modified: head/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- head/sys/cam/scsi/scsi_enc_ses.c	Mon Apr  6 17:28:17 2020	(r359661)
+++ head/sys/cam/scsi/scsi_enc_ses.c	Mon Apr  6 18:42:01 2020	(r359662)
@@ -2004,11 +2004,11 @@ ses_sanitize_elm_desc(const char *desc, uint16_t *len)
 	int i;
 
 	for (i = 0; i < *len; i++) {
-		if (desc[i] < 0x20 || desc[i] > 0x7e) {
+		if (desc[i] == 0) {
+			break;
+		} else if (desc[i] < 0x20 || desc[i] > 0x7e) {
 			*len = strlen(invalid);
 			return (invalid);
-		} else if (desc[i] == 0) {
-			break;
 		}
 	}
 	return (desc);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202004061842.036Ig1Ga039962>