Aric Stewart aric@codeweavers.com writes:
@@ -2667,11 +2669,23 @@ BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSI }
/* Check well known SIDs first */
if (strchrW(lpAccountName,'\'))
{
lpAccountNamePtr = strrchrW(lpAccountName,'\\');
lpAccountNamePtr++;
lpDomainNamePtr = lpAccountName;
}
else
lpAccountNamePtr = lpAccountName;
for (i = 0; i < (sizeof(ACCOUNT_SIDS) / sizeof(ACCOUNT_SIDS[0])); i++) {
if (!strcmpiW(lpAccountName, ACCOUNT_SIDS[i].account) ||
(ACCOUNT_SIDS[i].alias && !strcmpiW(lpAccountName, ACCOUNT_SIDS[i].alias)))
/* check domain first */
if (lpDomainNamePtr && strncmpiW(lpDomainNamePtr, ACCOUNT_SIDS[i].domain, strlenW(ACCOUNT_SIDS[i].domain)))
continue;
You always need to check that the next char is a terminator when using functions like strncmpiW.