mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 12:17:12 +09:00
Staging: android: timed_gpio: Properly discard invalid timeout values.
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>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user