Linux IIO development
 help / color / mirror / Atom feed
* [PATCH v3] iio-utils: fix memory overflow for dynamically allocateded memory to hold filename
@ 2010-05-25  9:40 Barry Song
  2010-05-25 10:07 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Barry Song @ 2010-05-25  9:40 UTC (permalink / raw)
  To: jic23, gregkh; +Cc: linux-iio, Barry Song

Signed-off-by: Barry Song <21cnbao@gmail.com>
---
 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",
-- 
1.5.6.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v3] iio-utils: fix memory overflow for dynamically allocateded memory to hold filename
  2010-05-25  9:40 [PATCH v3] iio-utils: fix memory overflow for dynamically allocateded memory to hold filename Barry Song
@ 2010-05-25 10:07 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2010-05-25 10:07 UTC (permalink / raw)
  To: Barry Song; +Cc: gregkh, linux-iio

On 05/25/10 10:40, Barry Song wrote:
> Signed-off-by: Barry Song <21cnbao@gmail.com>
Acked-by: Jonathan Cameron <jic23@cam.ac.uk>

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",


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-05-25 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-25  9:40 [PATCH v3] iio-utils: fix memory overflow for dynamically allocateded memory to hold filename Barry Song
2010-05-25 10:07 ` Jonathan Cameron

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox