Avoid a possible buffer overflow in winpty-debugserver.exe
Also: use fwrite directly instead of printf; maybe it's a bit faster.
This commit is contained in:
parent
6c8b7effe5
commit
6720daa07a
@ -37,7 +37,7 @@ int main() {
|
||||
10 * 1000,
|
||||
NULL);
|
||||
|
||||
char msgBuffer[MSG_SIZE];
|
||||
char msgBuffer[MSG_SIZE + 1];
|
||||
|
||||
while (true) {
|
||||
if (!ConnectNamedPipe(serverPipe, NULL)) {
|
||||
@ -52,8 +52,8 @@ int main() {
|
||||
DisconnectNamedPipe(serverPipe);
|
||||
continue;
|
||||
}
|
||||
msgBuffer[bytesRead] = '\0';
|
||||
printf("%s\n", msgBuffer);
|
||||
msgBuffer[bytesRead] = '\n';
|
||||
fwrite(msgBuffer, 1, bytesRead + 1, stdout);
|
||||
fflush(stdout);
|
||||
|
||||
DWORD bytesWritten = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user