]> source.dussan.org Git - tigervnc.git/commitdiff
Fix -PasswordFile, which was causing asserts. Since we are providing
authorPeter Åstrand <astrand@cendio.se>
Wed, 3 Dec 2008 11:57:18 +0000 (11:57 +0000)
committerPeter Åstrand <astrand@cendio.se>
Wed, 3 Dec 2008 11:57:18 +0000 (11:57 +0000)
our own buffer for ObfuscatedPasswd, we need to take it (so that it's
set to zero) to prevent CharArray destructor from trying to free it.

Also, memset the fixed length of the data variable, rather than rely
on strlen, since the string might not be null terminated.

git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3288 3789f03b-4d11-0410-bbf8-ca57d06f2519

win/vncviewer/CConn.cxx

index 4a9b341a0f82e0f6b402ac36b808b9dadb8f35a2..94ce8915f78c1ab4af3828d9d23f03281ff8318b 100644 (file)
@@ -738,8 +738,9 @@ void CConn::getUserPasswd(char** user, char** password) {
        obfPwd.buf = data;
        obfPwd.length  = datalen; 
        PlainPasswd passwd(obfPwd);
+       obfPwd.takeBuf();
        *password = strDup(passwd.buf);
-       memset(data, 0, strlen(data));
+       memset(data, 0, sizeof(data));
       }
     }
   }