BASE: Fix potential memory override when parsing long options

This commit is contained in:
Eugene Sandulenko 2023-01-03 23:46:59 +01:00
parent a38719640c
commit a404ddaee6
No known key found for this signature in database
GPG key ID: 014D387312D34F08

View file

@ -458,7 +458,7 @@ static Common::String createTemporaryTarget(const Common::String &engineId, cons
// Use this for options which have an *optional* value
#define DO_OPTION_OPT(shortCmd, longCmd, defaultVal) \
if (isLongCmd ? (!strcmp(s + 2, longCmd) || !memcmp(s + 2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
if (isLongCmd ? (!strcmp(s + 2, longCmd) || !strncmp(s + 2, longCmd"=", sizeof(longCmd"=") - 1)) : (tolower(s[1]) == shortCmd)) { \
s += 2; \
if (isLongCmd) { \
s += sizeof(longCmd) - 1; \