Damjan Jovanovic : wldap32: Cyrus SASL's sasl_interact_t.result should be null-terminated.
Alexandre Julliard
julliard at winehq.org
Fri Feb 5 16:50:48 CST 2021
Module: wine
Branch: master
Commit: a4199fa255119f3048a81fd1182ef60ea0be4d8d
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a4199fa255119f3048a81fd1182ef60ea0be4d8d
Author: Damjan Jovanovic <damjan.jov at gmail.com>
Date: Fri Feb 5 09:37:28 2021 +0200
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 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/wldap32/wldap32.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/wldap32/wldap32.h b/dlls/wldap32/wldap32.h
index 537de67a877..3059df8603e 100644
--- a/dlls/wldap32/wldap32.h
+++ b/dlls/wldap32/wldap32.h
@@ -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;
}
}
More information about the wine-cvs
mailing list