Staging: android: timed_gpio: Properly discard invalid timeout values.
authorMike Lockwood <lockwood@android.com>
Sat, 17 Apr 2010 16:01:35 +0000 (12:01 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 30 Nov 2011 11:51:36 +0000 (20:51 +0900)
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/android/timed_output.c

index 62e79180421b3d7eb5ef837eee0442cb9722ad3d..f373422308e01619e3a537790a8abe70ea31031c 100644 (file)
@@ -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;
This page took 0.041356 seconds and 5 git commands to generate.