1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-23 22:49:09 +00:00

(svn r15171) -Fix (r15027): Buffer underflow in case there are no settings to save for an AI.

This commit is contained in:
Yexo
2009-01-20 15:58:40 +00:00
parent 38afe1fe3f
commit 61ee8ca42a

View File

@@ -208,5 +208,7 @@ void AIConfig::SettingsToString(char *string, int size)
strcat(string, no);
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';
}