From owner-svn-src-all@FreeBSD.ORG Thu Jun 19 19:28:35 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id A538A300; Thu, 19 Jun 2014 19:28:35 +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 92B352227; Thu, 19 Jun 2014 19:28:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s5JJSZco004624; Thu, 19 Jun 2014 19:28:35 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s5JJSZcw004623; Thu, 19 Jun 2014 19:28:35 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201406191928.s5JJSZcw004623@svn.freebsd.org> From: Alexander Motin Date: Thu, 19 Jun 2014 19:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r267648 - head/usr.sbin/ctld X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Jun 2014 19:28:35 -0000 Author: mav Date: Thu Jun 19 19:28:35 2014 New Revision: 267648 URL: http://svnweb.freebsd.org/changeset/base/267648 Log: serial_num and device_id fields are not necessarily null-terminated. Before this it was impossible to use all 16 bytes of serial number, and client always got serial number NULL-terminated, that is not required. MFC after: 2 weeks Modified: head/usr.sbin/ctld/kernel.c Modified: head/usr.sbin/ctld/kernel.c ============================================================================== --- head/usr.sbin/ctld/kernel.c Thu Jun 19 18:35:14 2014 (r267647) +++ head/usr.sbin/ctld/kernel.c Thu Jun 19 19:28:35 2014 (r267648) @@ -413,13 +413,13 @@ kernel_lun_add(struct lun *lun) req.reqdata.create.device_type = T_DIRECT; if (lun->l_serial != NULL) { - strlcpy(req.reqdata.create.serial_num, lun->l_serial, + strncpy(req.reqdata.create.serial_num, lun->l_serial, sizeof(req.reqdata.create.serial_num)); req.reqdata.create.flags |= CTL_LUN_FLAG_SERIAL_NUM; } if (lun->l_device_id != NULL) { - strlcpy(req.reqdata.create.device_id, lun->l_device_id, + strncpy(req.reqdata.create.device_id, lun->l_device_id, sizeof(req.reqdata.create.device_id)); req.reqdata.create.flags |= CTL_LUN_FLAG_DEVID; }