Re: [PATCHv5 2/5] scsi: Export blacklist flags to sysfs

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

 



On Fri, 2017-09-22 at 08:04 +0200, Hannes Reinecke wrote:
> +static ssize_t
> +sdev_show_blacklist(struct device *dev, struct device_attribute *attr,
> +		    char *buf)
> +{

Please make this function accept the output buffer size as fourth argument.

> +		if (len)
> +			len += snprintf(buf + len, 2, " ");
> +
> +		if (name)
> +			len += snprintf(buf + len, strlen(name) + 1,
> +					"%s", name);
> +		else
> +			len += snprintf(buf + len, 67,
> +					"INVALID_BIT(%d)", i);
+	}
> +	if (len)
> +		len += snprintf(buf + len, 2, "\n");

Please adjust the snprintf() statements such that no buffer overflow can be
triggered.

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