From 22a203d843c83d1729e038512667c1e1188ece7a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 12 Nov 2015 18:26:26 +0000 Subject: [PATCH] qla2x00t: Suppress a Coverity complaint about a potential buffer overflow Coverity reported the following: Copy into fixed size buffer (STRING_OVERFLOW) fixed_size_dest: You might overrun the 17 byte fixed-size string ha->model_number by copying def without checking the length. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6683 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t/qla_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/qla2x00t/qla_init.c b/qla2x00t/qla_init.c index 995aecf14..76c946f7b 100644 --- a/qla2x00t/qla_init.c +++ b/qla2x00t/qla_init.c @@ -2190,7 +2190,8 @@ qla2x00_set_model_info(scsi_qla_host_t *vha, uint8_t *model, size_t len, qla2x00_model_name[index * 2 + 1], sizeof(ha->model_desc) - 1); } else { - strcpy(ha->model_number, def); + strlcpy(ha->model_number, def, + sizeof(ha->model_number)); } } if (IS_FWI2_CAPABLE(ha))