Fix -PasswordFile, which was causing asserts. Since we are providing
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
diff --git a/win/vncviewer/CConn.cxx b/win/vncviewer/CConn.cxx
index 4a9b341..94ce891 100644
--- a/win/vncviewer/CConn.cxx
+++ b/win/vncviewer/CConn.cxx
@@ -738,8 +738,9 @@
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));
}
}
}