[MSGINA] Fix copying the TokenSource string

TOKEN_SOURCE::SourceString is an 8 char non-null-terminated string. Copy it as such.

Fixes GCC 8 warning:
dll/win32/msgina/lsa.c:195:5: error: 'strncpy' output truncated before terminating nul copying 8 bytes from a string of the same length [-Werror=stringop-truncation]
     strncpy(TokenSource.SourceName, "User32  ", sizeof(TokenSource.SourceName));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-27 18:42:21 +02:00
parent f3a9b524f1
commit 2800837dc0

View file

@ -48,6 +48,8 @@ ConnectToLsa(
return Status;
}
static const CHAR User32TokenSourceName[] = "User32 ";
C_ASSERT(sizeof(User32TokenSourceName) == RTL_FIELD_SIZE(TOKEN_SOURCE, SourceName) + 1);
NTSTATUS
MyLogonUser(
@ -192,7 +194,7 @@ MyLogonUser(
SE_GROUP_ENABLED_BY_DEFAULT;
/* Set the token source */
strncpy(TokenSource.SourceName, "User32 ", sizeof(TokenSource.SourceName));
RtlCopyMemory(TokenSource.SourceName, User32TokenSourceName, sizeof(TokenSource.SourceName));
AllocateLocallyUniqueId(&TokenSource.SourceIdentifier);
Status = LsaLogonUser(LsaHandle,