sensorctl: change scanf to cin for security issue 51/150551/2
authorkibak.yoon <kibak.yoon@samsung.com>
Mon, 18 Sep 2017 02:09:16 +0000 (11:09 +0900)
committerkibak.yoon <kibak.yoon@samsung.com>
Mon, 18 Sep 2017 02:11:22 +0000 (11:11 +0900)
Change-Id: Id5760c1fe643729d67716323360cb43d0147aa7b
Signed-off-by: kibak.yoon <kibak.yoon@samsung.com>
src/sensorctl/tester_manual.cpp

index 2e40851..cc10bd1 100644 (file)
@@ -17,6 +17,7 @@
  *
  */
 
+#include <iostream>
 #include <getopt.h>
 
 #include "tester.h"
@@ -130,8 +131,7 @@ TESTCASE(manual_test, sensor)
 
        if (sensor_adapter::get_count(stype) > 1) {
                _N("There are more than 2 sensors. please enter the index : ");
-               if (scanf("%d", &index) != 1)
-                       return false;
+               std::cin >> index;
        }
 
        sensor_info info(stype, index, interval, latency, powersave, test_cb, NULL);