Skip to content

Commit

Permalink
Legacy behavior for INI read int/float when value does not contain an…
Browse files Browse the repository at this point in the history
…y numbers. (#283)
  • Loading branch information
MiranDMC authored Feb 5, 2025
1 parent 77ac18d commit bd49199
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cleo_plugins/IniFiles/IniFiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ class IniFiles
// parse
char* end;
int value = strtol(str, &end, base);
if (end != str) // at least one number character consumed
if (end != str || // at least one number character consumed
IsLegacyScript(thread)) // old CLEO reported success anyway with value 0
{
OPCODE_WRITE_PARAM_INT(value);
OPCODE_CONDITION_RESULT(true);
Expand Down Expand Up @@ -130,7 +131,8 @@ class IniFiles
value = strtof(str, &end);
}

if (end != str) // at least one number character consumed
if (end != str || // at least one number character consumed
IsLegacyScript(thread)) // old CLEO reported success anyway with value 0
{
OPCODE_WRITE_PARAM_FLOAT(value);
OPCODE_CONDITION_RESULT(true);
Expand Down

0 comments on commit bd49199

Please sign in to comment.