Skip to content

Commit

Permalink
Staging: iio-utils: fix memory overflow for dynamically allocateded m…
Browse files Browse the repository at this point in the history
…emory 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>
  • Loading branch information
Barry Song authored and Greg Kroah-Hartman committed Jun 4, 2010
1 parent c3dee74 commit b6ee30a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/staging/iio/Documentation/iio_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit b6ee30a

Please sign in to comment.