mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 16:57:31 +01:00
Clean strlcpy arguments
This commit is contained in:
committed by
EmilieNumworks
parent
06999e8e2e
commit
5d92f13c26
@@ -332,13 +332,14 @@ void ConsoleController::printText(const char * text, size_t length) {
|
||||
void ConsoleController::autoImportScript(Script script, bool force) {
|
||||
if (script.importationStatus() || force) {
|
||||
// Create the command "from scriptName import *".
|
||||
assert(strlen(k_importCommand1) + strlen(script.name()) - strlen(ScriptStore::k_scriptExtension) + strlen(k_importCommand2) + 1 <= k_maxImportCommandSize);
|
||||
char command[k_maxImportCommandSize];
|
||||
size_t currentChar = strlcpy(command, k_importCommand1, strlen(k_importCommand1)+1);
|
||||
size_t currentChar = strlcpy(command, k_importCommand1, k_maxImportCommandSize);
|
||||
const char * scriptName = script.name();
|
||||
currentChar += strlcpy(command+currentChar, scriptName, strlen(scriptName)+1);
|
||||
currentChar += strlcpy(command+currentChar, scriptName, k_maxImportCommandSize - currentChar);
|
||||
// Remove the name extension ".py"
|
||||
currentChar -= strlen(ScriptStore::k_scriptExtension);
|
||||
currentChar += strlcpy(command+currentChar, k_importCommand2, strlen(k_importCommand2)+1);
|
||||
currentChar += strlcpy(command+currentChar, k_importCommand2, k_maxImportCommandSize - currentChar);
|
||||
runAndPrintForCommand(command);
|
||||
}
|
||||
if (force) {
|
||||
|
||||
Reference in New Issue
Block a user