[strlcpy] Assertions on len parameter

This commit is contained in:
Léa Saviot
2019-08-07 14:48:50 +02:00
committed by Émilie Feral
parent b0b10f184e
commit c2b4d2b760
10 changed files with 23 additions and 5 deletions

View File

@@ -400,10 +400,12 @@ void ConsoleController::autoImportScript(Script script, bool force) {
/* Copy the script name without the extension ".py". The '.' is overwritten
* by the null terminating char. */
int copySizeWithNullTerminatingZero = minInt(k_maxImportCommandSize - currentChar, strlen(scriptName) - strlen(ScriptStore::k_scriptExtension));
strlcpy(command+currentChar, scriptName, copySizeWithNullTerminatingZero);
assert(convertFloatToText >= 0);
strlcpy(command+currentChar, scriptName, );
currentChar += copySizeWithNullTerminatingZero-1;
// Copy " import *"
assert(k_maxImportCommandSize >= currentChar);
strlcpy(command+currentChar, k_importCommand2, k_maxImportCommandSize - currentChar);
// Step 2 - Run the command