lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Date:   Fri,  2 Feb 2018 14:12:15 +0100
From:   Arnd Bergmann <arnd@...db.de>
To:     linux-scsi@...r.kernel.org,
        "James E . J . Bottomley" <jejb@...ux.vnet.ibm.com>,
        Johannes Thumshirn <jth@...nel.org>,
        "Martin K. Petersen" <martin.petersen@...cle.com>
Cc:     Nicolas Pitre <nico@...aro.org>, Andi Kleen <ak@...ux.intel.com>,
        Arnd Bergmann <arnd@...db.de>, linux-kernel@...r.kernel.org
Subject: [PATCH 1/6] scsi: fc_encode: work around strncpy size warnings

struct fc_fdmi_attr_entry contains a variable-length string at
the end, which is encoded as a one-byte array.  gcc-8 notices that
we copy strings into it that obviously go beyond that one byte:

In function 'fc_ct_ms_fill',
    inlined from 'fc_elsct_send' at include/scsi/fc_encode.h:518:8:
include/scsi/fc_encode.h:275:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=]
   strncpy((char *)&entry->value,
   ^
include/scsi/fc_encode.h:287:3: error: 'strncpy' writing 64 bytes into a region of size 1 overflows the destination [-Werror=stringop-overflow=]
   strncpy((char *)&entry->value,
   ^

No idea what the right fix is.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 include/scsi/fc/fc_ms.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/scsi/fc/fc_ms.h b/include/scsi/fc/fc_ms.h
index f52b921b5c70..c5614e725a0e 100644
--- a/include/scsi/fc/fc_ms.h
+++ b/include/scsi/fc/fc_ms.h
@@ -128,7 +128,7 @@ struct fc_fdmi_port_name {
 struct fc_fdmi_attr_entry {
 	__be16		type;
 	__be16		len;
-	__u8		value[1];
+	__u8		value[];
 } __attribute__((__packed__));
 
 /*
-- 
2.9.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ