windows: Make sure the string returned from ReadConsole() is null terminated
authorTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 09:49:34 +0000 (11:49 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 2 Jul 2014 10:38:44 +0000 (12:38 +0200)
src/libstrongswan/utils/windows.c

index 397f3b1..2168d64 100644 (file)
@@ -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');