forked from Minki/linux
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>
This commit is contained in:
parent
c3dee74f52
commit
b6ee30a27f
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user