Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Apr 2020 13:33:01 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r359860 - stable/12/sys/cam/scsi
Message-ID:  <202004131333.03DDX16M080769@repo.freebsd.org>

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

Log:
  MFC r359662: 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.

Modified:
  stable/12/sys/cam/scsi/scsi_enc_ses.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/scsi/scsi_enc_ses.c
==============================================================================
--- stable/12/sys/cam/scsi/scsi_enc_ses.c	Mon Apr 13 09:09:28 2020	(r359859)
+++ stable/12/sys/cam/scsi/scsi_enc_ses.c	Mon Apr 13 13:33:01 2020	(r359860)
@@ -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?202004131333.03DDX16M080769>