Re: [patch 2/2] target: strlen() doesn't count the terminator

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

 



On Tue, 2012-10-02 at 11:27 +0300, Dan Carpenter wrote:
> We need to take the terminator into consideration here or the last
> character gets silently truncated away later.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/usb/gadget/tcm_usb_gadget.c b/drivers/usb/gadget/tcm_usb_gadget.c
> index 1ad4a69..97e68b3 100644
> --- a/drivers/usb/gadget/tcm_usb_gadget.c
> +++ b/drivers/usb/gadget/tcm_usb_gadget.c
> @@ -1812,7 +1812,7 @@ static ssize_t tcm_usbg_tpg_store_nexus(
>  		ret = tcm_usbg_drop_nexus(tpg);
>  		return (!ret) ? count : ret;
>  	}
> -	if (strlen(page) > USBG_NAMELEN) {
> +	if (strlen(page) >= USBG_NAMELEN) {
>  		pr_err("Emulated NAA Sas Address: %s, exceeds"
>  				" max: %d\n", page, USBG_NAMELEN);
>  		return -EINVAL;
> --

Also applied to for-next.

Thanks Dan !

--nab


--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux