From 8bf304b867a3e22fe6a48e2223dbd230c9d91bca Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 21 Mar 2021 21:54:30 +0100 Subject: [PATCH] Added check for non-numeric characters in the arguments for the --resolution flag. --- es-app/src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 75510a613..b2150e198 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -182,6 +182,13 @@ bool parseArgs(int argc, char* argv[]) std::cerr << "Error: Invalid resolution values supplied.\n"; return false; } + std::string widthArg = argv[i + 1]; + std::string heightArg = argv[i + 2]; + if (widthArg.find_first_not_of("0123456789") != std::string::npos || + heightArg.find_first_not_of("0123456789") != std::string::npos) { + std::cerr << "Error: Invalid resolution values supplied.\n"; + return false; + } int width = atoi(argv[i + 1]); int height = atoi(argv[i + 2]); if (width < 640 || height < 480 || width > 7680 || height > 4320 ||