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
This commit is contained in:
Alexander Motin 2014-06-19 19:28:35 +00:00
parent 2f951d2989
commit 8ea4f2ef51

View File

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