From 3acde309eda9f0c6b760bdacc28621aa8abb66a7 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Fri, 12 Oct 2018 14:50:25 +0200 Subject: [PATCH] credui: Correctly check for duplicated username entries in CredDialogFillUsernameCombo. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/credui/credui_main.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/dlls/credui/credui_main.c b/dlls/credui/credui_main.c index 1b9c71b256f..99aa9a12dd9 100644 --- a/dlls/credui/credui_main.c +++ b/dlls/credui/credui_main.c @@ -160,20 +160,27 @@ static void CredDialogFillUsernameCombo(HWND hwndUsername, const struct cred_dia DWORD j; BOOL duplicate = FALSE; + if (!credentials[i]->UserName) + continue; + if (params->dwFlags & CREDUI_FLAGS_GENERIC_CREDENTIALS) { - if ((credentials[i]->Type != CRED_TYPE_GENERIC) || !credentials[i]->UserName) + if (credentials[i]->Type != CRED_TYPE_GENERIC) + { + credentials[i]->UserName = NULL; continue; + } } - else + else if (credentials[i]->Type == CRED_TYPE_GENERIC) { - if (credentials[i]->Type == CRED_TYPE_GENERIC) - continue; + credentials[i]->UserName = NULL; + continue; } /* don't add another item with the same name if we've already added it */ for (j = 0; j < i; j++) - if (!strcmpW(credentials[i]->UserName, credentials[j]->UserName)) + if (credentials[j]->UserName + && !strcmpW(credentials[i]->UserName, credentials[j]->UserName)) { duplicate = TRUE; break;