summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBarry Song <21cnbao@gmail.com>2010-05-25 17:40:04 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-06-04 13:38:57 -0700
commitb6ee30a27f8204d20aebe6e743e38d4b85ee753d (patch)
tree904cdea0dc2d98cc7bede32968da06808802235b
parentc3dee74f52bb844db40865dae3c465212c6a09eb (diff)
downloadlinux-b6ee30a27f8204d20aebe6e743e38d4b85ee753d.tar.bz2
Staging: iio-utils: fix memory overflow for dynamically allocateded memory to hold filename
Signed-off-by: Barry Song <21cnbao@gmail.com> Acked-by: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/staging/iio/Documentation/iio_utils.h3
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 a4555e6f133f..014f6684faba 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",