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: Damjan Jovanovic <damjan.jov@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d457a986de
commit
a4199fa255
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue