From 7b8ad567909928d39444a5fc9444c177b10ecd09 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 17 Jun 2015 00:36:22 +0000 Subject: [PATCH] qla2x00t: Fix a potential buffer overflow Detected by Coverity. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6391 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index 074ce7300..e0c01ceca 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -2187,8 +2187,9 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len, if (use_tbl && ha->pdev->subsystem_vendor == PCI_VENDOR_ID_QLOGIC && index < QLA_MODEL_NAMES) { - strcpy(ha->model_number, - qla2x00_model_name[index * 2]); + strlcpy(ha->model_number, + qla2x00_model_name[index * 2], + sizeof(ha->model_number)); strncpy(ha->model_desc, qla2x00_model_name[index * 2 + 1], sizeof(ha->model_desc) - 1);