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);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to