https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3cddd76f57130581f691d8...
commit 3cddd76f57130581f691d8936f38ee3ac8a2dc91 Author: Timo Kreuzer timo.kreuzer@reactos.org AuthorDate: Wed Aug 21 11:05:09 2024 +0300 Commit: Timo Kreuzer timo.kreuzer@reactos.org CommitDate: Fri Aug 30 06:38:29 2024 +0300
[RTL] Fix overflow case in vDbgPrintExWithPrefixInternal
The string should always be NULL terminated. --- sdk/lib/rtl/debug.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/sdk/lib/rtl/debug.c b/sdk/lib/rtl/debug.c index 3c0be055496..f9e9c192295 100644 --- a/sdk/lib/rtl/debug.c +++ b/sdk/lib/rtl/debug.c @@ -102,10 +102,11 @@ vDbgPrintExWithPrefixInternal(IN PCCH Prefix, if (Length == MAXULONG) { /* Terminate it if we went over-board */ - Buffer[sizeof(Buffer) - 1] = '\n'; + Buffer[sizeof(Buffer) - 2] = '\n'; + Buffer[sizeof(Buffer) - 1] = '\0';
/* Put maximum */ - Length = sizeof(Buffer); + Length = sizeof(Buffer) - 1; } else {