[PATCH v2] iio-utils: fix memory overflow fordynamically allocateded memory to hold filename

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

 



Signed-off-by: Barry Song <21cnbao@xxxxxxxxx>
---
 drivers/staging/iio/Documentation/iio_utils.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/iio/Documentation/iio_utils.h b/drivers/staging/iio/Documentation/iio_utils.h
index a4555e6..6411bf9 100644
--- a/drivers/staging/iio/Documentation/iio_utils.h
+++ b/drivers/staging/iio/Documentation/iio_utils.h
@@ -64,7 +64,8 @@ inline int find_type_by_name(const char *name, const char *type)
 						+ strlen(type)
 						+ 1
 						+ numstrlen
-						+ 1);
+						+ 1
+						+ IIO_MAX_NAME_LENGTH);
 				if (filename == NULL)
 					return -ENOMEM;
 				sprintf(filename, "%s%s%d/name",
-- 
1.5.6.3

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