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:
Родитель
c3dee74f52
Коммит
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",
|
||||
|
|
Загрузка…
Ссылка в новой задаче