Skip to content

Commit 1e09b1d

Browse files
scsi: lpfc: Use memcpy() for BIOS version
jira VULN-72459 cve CVE-2025-38332 commit-author Daniel Wagner <[email protected]> commit ae82eaf The strlcat() with FORTIFY support is triggering a panic because it thinks the target buffer will overflow although the correct target buffer size is passed in. Anyway, instead of memset() with 0 followed by a strlcat(), just use memcpy() and ensure that the resulting buffer is NULL terminated. BIOSVersion is only used for the lpfc_printf_log() which expects a properly terminated string. Signed-off-by: Daniel Wagner <[email protected]> Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Justin Tee <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]> (cherry picked from commit ae82eaf) Signed-off-by: Shreeya Patel <[email protected]>
1 parent 78abc03 commit 1e09b1d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6008,9 +6008,9 @@ lpfc_sli4_get_ctl_attr(struct lpfc_hba *phba)
60086008
phba->sli4_hba.flash_id = bf_get(lpfc_cntl_attr_flash_id, cntl_attr);
60096009
phba->sli4_hba.asic_rev = bf_get(lpfc_cntl_attr_asic_rev, cntl_attr);
60106010

6011-
memset(phba->BIOSVersion, 0, sizeof(phba->BIOSVersion));
6012-
strlcat(phba->BIOSVersion, (char *)cntl_attr->bios_ver_str,
6011+
memcpy(phba->BIOSVersion, cntl_attr->bios_ver_str,
60136012
sizeof(phba->BIOSVersion));
6013+
phba->BIOSVersion[sizeof(phba->BIOSVersion) - 1] = '\0';
60146014

60156015
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
60166016
"3086 lnk_type:%d, lnk_numb:%d, bios_ver:%s, "

0 commit comments

Comments
 (0)