Skip to content

Commit

Permalink
Staging: android: timed_gpio: Properly discard invalid timeout values.
Browse files Browse the repository at this point in the history
The timed output device never previously checked the return value of sscanf,
resulting in an uninitialized int being passed to enable() if input value
was invalid.

Signed-off-by: Mike Lockwood <lockwood@android.com>
  • Loading branch information
mikeandroid committed Apr 17, 2010
1 parent 0fc7f96 commit a7f5cb9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/staging/android/timed_output.c
Expand Up @@ -41,7 +41,9 @@ static ssize_t enable_store(
struct timed_output_dev *tdev = dev_get_drvdata(dev);
int value;

sscanf(buf, "%d", &value);
if (sscanf(buf, "%d", &value) != 1)
return -EINVAL;

tdev->enable(tdev, value);

return size;
Expand Down

0 comments on commit a7f5cb9

Please sign in to comment.