Fix missing null terminator when calling execv() on modprobe (#13054)

This commit is contained in:
Blue 2025-06-05 01:11:01 +00:00 committed by GitHub
parent c3264b73f5
commit 0c8844e0f2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 2 deletions

View File

@ -3383,7 +3383,7 @@ try
const std::string KernelModulesList = wsl::shared::string::FromSpan(Buffer, EarlyConfig->KernelModulesListOffset);
for (const auto& Module : wsl::shared::string::Split(KernelModulesList, ','))
{
const char* Argv[] = {MODPROBE_PATH, Module.c_str()};
const char* Argv[] = {MODPROBE_PATH, Module.c_str(), nullptr};
int Status = -1;
auto result = UtilCreateProcessAndWait(MODPROBE_PATH, Argv, &Status);
if (result < 0)

View File

@ -682,7 +682,7 @@ Return Value:
// 2. In sometime we probably will replace most of these string constants
// with std::string anyway.
execv(File, const_cast<char* const*>(Argv));
LOG_ERROR("{} failed with {}", File, errno);
LOG_ERROR("execv({}) failed with {}", File, errno);
exit(-1);
}