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,
|
10 * 1000,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
char msgBuffer[MSG_SIZE];
|
char msgBuffer[MSG_SIZE + 1];
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!ConnectNamedPipe(serverPipe, NULL)) {
|
if (!ConnectNamedPipe(serverPipe, NULL)) {
|
||||||
@ -52,8 +52,8 @@ int main() {
|
|||||||
DisconnectNamedPipe(serverPipe);
|
DisconnectNamedPipe(serverPipe);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
msgBuffer[bytesRead] = '\0';
|
msgBuffer[bytesRead] = '\n';
|
||||||
printf("%s\n", msgBuffer);
|
fwrite(msgBuffer, 1, bytesRead + 1, stdout);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
DWORD bytesWritten = 0;
|
DWORD bytesWritten = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user