mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 03:51:18 +00:00
Fix out of bounds access when stdout is empty
This commit is contained in:
committed by
Christoffer Lerno
parent
a52b30c951
commit
43163fe2a0
@@ -292,6 +292,7 @@ fn String? execute_stdout_to_buffer(char[] buffer, String[] command_line, SubPro
|
||||
SubProcess process = process::create(command_line, options, environment)!;
|
||||
process.join()!;
|
||||
usz len = process.read_stdout(buffer.ptr, buffer.len)!;
|
||||
if (len == 0) return "";
|
||||
return (String)buffer[:len - 1];
|
||||
}
|
||||
|
||||
@@ -529,4 +530,4 @@ fn bool? SubProcess.is_running(&self)
|
||||
self.join()!;
|
||||
return false;
|
||||
$endif
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user