From 0a26f39a71fe431b301b482d026c34b59577b91d Mon Sep 17 00:00:00 2001 From: Tobias Brunner Date: Wed, 2 Jul 2014 11:49:34 +0200 Subject: [PATCH] windows: Make sure the string returned from ReadConsole() is null terminated --- src/libstrongswan/utils/windows.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/libstrongswan/utils/windows.c b/src/libstrongswan/utils/windows.c index 397f3b156..2168d6440 100644 --- a/src/libstrongswan/utils/windows.c +++ b/src/libstrongswan/utils/windows.c @@ -291,6 +291,8 @@ char* getpass(const char *prompt) SetConsoleMode(in, mode); return NULL; } + buf[sizeof(buf)-1] = '\0'; + if (done) { pos = strchr(buf, '\r');