diff options
author | Barry Song <21cnbao@gmail.com> | 2010-05-25 05:40:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-06-04 16:38:57 -0400 |
commit | b6ee30a27f8204d20aebe6e743e38d4b85ee753d (patch) | |
tree | 904cdea0dc2d98cc7bede32968da06808802235b /drivers/staging | |
parent | c3dee74f52bb844db40865dae3c465212c6a09eb (diff) |
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>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | 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 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) | |||
62 | 1) != 0) { | 62 | 1) != 0) { |
63 | filename = malloc(strlen(iio_dir) | 63 | filename = malloc(strlen(iio_dir) |
64 | + strlen(type) | 64 | + strlen(type) |
65 | + 1 | ||
66 | + numstrlen | 65 | + numstrlen |
67 | + 1); | 66 | + 6); |
68 | if (filename == NULL) | 67 | if (filename == NULL) |
69 | return -ENOMEM; | 68 | return -ENOMEM; |
70 | sprintf(filename, "%s%s%d/name", | 69 | sprintf(filename, "%s%s%d/name", |