https://git.reactos.org/?p=reactos.git;a=commitdiff;h=2800837dc0b6783d6c4fb6...
commit 2800837dc0b6783d6c4fb61db2ce6e51199d3c47 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Sat Apr 27 18:42:21 2019 +0200 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Sat Jul 20 13:56:18 2019 +0200
[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)); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- dll/win32/msgina/lsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dll/win32/msgina/lsa.c b/dll/win32/msgina/lsa.c index 16eaf68fdd3..dca3cc0e1d8 100644 --- a/dll/win32/msgina/lsa.c +++ b/dll/win32/msgina/lsa.c @@ -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,