svn commit: r267648 - head/usr.sbin/ctld

Alexander Motin mav at FreeBSD.org
Thu Jun 19 19:28:35 UTC 2014


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;
 	}


More information about the svn-src-all mailing list