Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Jun 2014 19:28:35 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r267648 - head/usr.sbin/ctld
Message-ID:  <201406191928.s5JJSZcw004623@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201406191928.s5JJSZcw004623>