mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-17 21:25:40 +00:00
(svn r15171) -Fix (r15027): Buffer underflow in case there are no settings to save for an AI.
This commit is contained in:
parent
38afe1fe3f
commit
61ee8ca42a
@ -208,5 +208,7 @@ void AIConfig::SettingsToString(char *string, int size)
|
|||||||
strcat(string, no);
|
strcat(string, no);
|
||||||
strcat(string, ",");
|
strcat(string, ",");
|
||||||
}
|
}
|
||||||
string[strlen(string) - 1] = '\0';
|
/* Remove the last ',', but only if at least one setting was saved. */
|
||||||
|
size_t len = strlen(string);
|
||||||
|
if (len > 0) string[len - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user