From owner-svn-src-head@FreeBSD.ORG Wed Sep 10 06:25:18 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E6665163; Wed, 10 Sep 2014 06:25:18 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D20C4DDE; Wed, 10 Sep 2014 06:25:18 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id s8A6PIJP053694; Wed, 10 Sep 2014 06:25:18 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id s8A6PIhQ053693; Wed, 10 Sep 2014 06:25:18 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201409100625.s8A6PIhQ053693@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Wed, 10 Sep 2014 06:25:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r271352 - head/sys/cam/ctl X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Sep 2014 06:25:19 -0000 Author: mav Date: Wed Sep 10 06:25:18 2014 New Revision: 271352 URL: http://svnweb.freebsd.org/changeset/base/271352 Log: Fix minor buffer overflow reported by Coverity. CID: 1006781 Modified: head/sys/cam/ctl/ctl.c Modified: head/sys/cam/ctl/ctl.c ============================================================================== --- head/sys/cam/ctl/ctl.c Wed Sep 10 05:52:30 2014 (r271351) +++ head/sys/cam/ctl/ctl.c Wed Sep 10 06:25:18 2014 (r271352) @@ -10584,24 +10584,28 @@ ctl_inquiry_std(struct ctl_scsiio *ctsio */ if (lun == NULL || (val = ctl_get_opt(&lun->be_lun->options, "vendor")) == NULL) { - strcpy(inq_ptr->vendor, CTL_VENDOR); + strncpy(inq_ptr->vendor, CTL_VENDOR, sizeof(inq_ptr->vendor)); } else { memset(inq_ptr->vendor, ' ', sizeof(inq_ptr->vendor)); strncpy(inq_ptr->vendor, val, min(sizeof(inq_ptr->vendor), strlen(val))); } if (lun == NULL) { - strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); + strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT, + sizeof(inq_ptr->product)); } else if ((val = ctl_get_opt(&lun->be_lun->options, "product")) == NULL) { switch (lun->be_lun->lun_type) { case T_DIRECT: - strcpy(inq_ptr->product, CTL_DIRECT_PRODUCT); + strncpy(inq_ptr->product, CTL_DIRECT_PRODUCT, + sizeof(inq_ptr->product)); break; case T_PROCESSOR: - strcpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT); + strncpy(inq_ptr->product, CTL_PROCESSOR_PRODUCT, + sizeof(inq_ptr->product)); break; default: - strcpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT); + strncpy(inq_ptr->product, CTL_UNKNOWN_PRODUCT, + sizeof(inq_ptr->product)); break; } } else {