Re: [PATCH v3] iio-utils: fix memory overflow for dynamically allocateded memory to hold filename

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

 



On 05/25/10 10:40, Barry Song wrote:
> Signed-off-by: Barry Song <21cnbao@xxxxxxxxx>
Acked-by: Jonathan Cameron <jic23@xxxxxxxxx>

Thanks Barry!
> ---
>  drivers/staging/iio/Documentation/iio_utils.h |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
> index a4555e6..014f668 100644
> --- a/drivers/staging/iio/Documentation/iio_utils.h
> +++ b/drivers/staging/iio/Documentation/iio_utils.h
> @@ -62,9 +62,8 @@ inline int find_type_by_name(const char *name, const char *type)
>  					1) != 0) {
>  				filename = malloc(strlen(iio_dir)
>  						+ strlen(type)
> -						+ 1
>  						+ numstrlen
> -						+ 1);
> +						+ 6);
>  				if (filename == NULL)
>  					return -ENOMEM;
>  				sprintf(filename, "%s%s%d/name",

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


[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux