diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_loopback.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_loopback.cc index 78b87b12d4..1d02ca0b53 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_loopback.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_loopback.cc @@ -153,7 +153,11 @@ int VideoEngineSampleCode(void* window1, void* window2) captureIdx = 0; printf("0\n"); #else - scanf("%d", &captureIdx); + if (scanf("%d", &captureIdx) != 1) + { + printf("Error in scanf()\n"); + return -1; + } getchar(); captureIdx = captureIdx - 1; // Compensate for idx start at 1. #endif @@ -311,7 +315,11 @@ int VideoEngineSampleCode(void* window1, void* window2) codecIdx = 0; printf("0\n"); #else - scanf("%d", &codecIdx); + if (scanf("%d", &codecIdx) != 1) + { + printf("Error in scanf()\n"); + return -1; + } getchar(); codecIdx = codecIdx - 1; // Compensate for idx start at 1. #endif diff --git a/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc b/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc index 6d320bd045..47360d5450 100644 --- a/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc +++ b/src/video_engine/main/test/AutoTest/source/vie_autotest_main.cc @@ -331,17 +331,18 @@ int ViEAutoTestMain::GetClassTestSelection() ViETest::Log("\t 11. Go back to previous menu"); ViETest::Log("Select type of test: "); + int items_read = 0; if (_useAnswerFile) { //GetNextAnswer(answer); } else { - scanf("%d", &testType); + items_read = scanf("%d", &testType); getchar(); } ViETest::Log("\n"); - if (testType >= 1 && testType <= 13) + if (items_read == 1 && testType >= 1 && testType <= 13) { return testType; }