From 2d16ab52557078f083e773d103c67e411ff64fc2 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Wed, 11 Jan 2023 21:07:59 +0100 Subject: [PATCH] [winpr,sam] fix inalid NULL arguments --- winpr/libwinpr/utils/sam.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/winpr/libwinpr/utils/sam.c b/winpr/libwinpr/utils/sam.c index 25be24fc9..dd043638a 100644 --- a/winpr/libwinpr/utils/sam.c +++ b/winpr/libwinpr/utils/sam.c @@ -57,9 +57,11 @@ static WINPR_SAM_ENTRY* SamEntryFromDataA(LPCSTR User, DWORD UserLength, LPCSTR WINPR_SAM_ENTRY* entry = calloc(1, sizeof(WINPR_SAM_ENTRY)); if (!entry) return NULL; - entry->User = _strdup(User); + if (User && (UserLength > 0)) + entry->User = _strdup(User); entry->UserLength = UserLength; - entry->Domain = _strdup(Domain); + if (Domain && (DomainLength > 0)) + entry->Domain = _strdup(Domain); entry->DomainLength = DomainLength; return entry; }