Commit a4199fa2 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

wldap32: Cyrus SASL's sasl_interact_t.result should be null-terminated.

Sometimes AD authentication fails as LDAP packets have garbage characters trailing the username. Reading its source code confirms that Cyrus SASL often completely ignores the sasl_interact_t.len field, and expects sasl_interact_t.result to be null-terminated. Signed-off-by: 's avatarDamjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent d457a986
......@@ -100,9 +100,10 @@ static inline LPWSTR strnAtoW( LPCSTR str, DWORD inlen, DWORD *outlen )
if (str)
{
DWORD len = MultiByteToWideChar( CP_ACP, 0, str, inlen, NULL, 0 );
if ((ret = heap_alloc( len * sizeof(WCHAR) )))
if ((ret = heap_alloc( (len+1) * sizeof(WCHAR) )))
{
MultiByteToWideChar( CP_ACP, 0, str, inlen, ret, len );
ret[len] = 0;
*outlen = len;
}
}
......@@ -116,9 +117,10 @@ static inline char *strnWtoU( LPCWSTR str, DWORD inlen, DWORD *outlen )
if (str)
{
DWORD len = WideCharToMultiByte( CP_UTF8, 0, str, inlen, NULL, 0, NULL, NULL );
if ((ret = heap_alloc( len )))
if ((ret = heap_alloc( len + 1 )))
{
WideCharToMultiByte( CP_UTF8, 0, str, inlen, ret, len, NULL, NULL );
ret[len] = 0;
*outlen = len;
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment