diff options
author | Thierry Crozat | 2017-04-24 19:53:22 +0100 |
---|---|---|
committer | Thierry Crozat | 2017-04-24 20:04:05 +0100 |
commit | 5d91efa74d2f3228c88c9af01541e0e2d7912d47 (patch) | |
tree | c239badbcdf98b3ee2ae90282739841f71504631 | |
parent | 0bb8b4051c50ccf2178f4778fad2485732899754 (diff) | |
download | scummvm-rg350-5d91efa74d2f3228c88c9af01541e0e2d7912d47.tar.gz scummvm-rg350-5d91efa74d2f3228c88c9af01541e0e2d7912d47.tar.bz2 scummvm-rg350-5d91efa74d2f3228c88c9af01541e0e2d7912d47.zip |
BASE: Check scanf return value when adding a game
-rw-r--r-- | base/commandLine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/base/commandLine.cpp b/base/commandLine.cpp index e77ab6ce86..4f3d5687b4 100644 --- a/base/commandLine.cpp +++ b/base/commandLine.cpp @@ -889,7 +889,10 @@ static bool addGame(Common::String path) { } // Get user input - scanf("%i", &idx); + if (scanf("%i", &idx) != 1) { + printf("Invalid index. No game added.\n"); + return false; + } --idx; if (idx < 0 || idx >= (int)candidates.size()) { printf("Invalid index. No game added.\n"); |