Re: [PATCH] qedi: Fix truncation of name and secret

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2018-01-31 at 22:57 -0800, Nilesh Javali wrote:
> Adjust the NULL byte added by snprintf.

Hello Nilesh,

Sorry but neither the title nor the description of this patch make clear what
the intention of this patch is. Please describe this more clearly.

> @@ -1840,7 +1840,7 @@ static ssize_t qedi_show_boot_ini_info(void *data, int type, char *buf)
>  
>  	switch (type) {
>  	case ISCSI_BOOT_INI_INITIATOR_NAME:
> -		rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN, "%s\n",
> +		rc = snprintf(str, NVM_ISCSI_CFG_ISCSI_NAME_MAX_LEN + 1, "%s",
>  			      initiator->initiator_name.byte);
>  		break;
>  	default:

The function qedi_show_boot_ini_info() is used to export information through
sysfs. Users expect ASCII data in sysfs to be terminated with a newline. So I
think removing the trailing newline is wrong. Additionally, an explanation of
why you think that the second argument of the snprintf() call should be
increased is missing. And since buf points at a buffer of size PAGE_SIZE,
have you consider to change the second snprintf() argument into PAGE_SIZE?

Thanks,

Bart.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux