https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b275f24406b70ae0d9a9e…
commit b275f24406b70ae0d9a9e9d21b70b8bdcbcc3bce
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Apr 28 20:38:25 2019 +0200
Commit: Timo Kreuzer <timo.kreuzer(a)reactos.org>
CommitDate: Sat Jul 20 13:56:18 2019 +0200
[VFATLIB] Use RtlStringCbPrintfA instead of sprintf
Fixes GCC 8 warning:
sdk/lib/fslib/vfatlib/check/boot.c:173:27: error: '%02x' directive writing
between 2 and 8 bytes into a region of size between 0 and 15 [-Werror=format-overflow=]
sprintf(buf, "%s%u:%02x/%02x", first ? "" : ", ",
^~~~
sdk/lib/fslib/vfatlib/check/boot.c:173:16: note: directive argument in the range [0,
2147483647]
sprintf(buf, "%s%u:%02x/%02x", first ? "" : ", ",
^~~~~~~~~~~~~~~~
sdk/lib/fslib/vfatlib/check/boot.c:173:3: note: 'sprintf' output between 8 and
31 bytes into a destination of size 20
sprintf(buf, "%s%u:%02x/%02x", first ? "" : ", ",
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(unsigned)(p - (uint8_t *) b), *p, *q);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
---
sdk/lib/fslib/vfatlib/check/boot.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/sdk/lib/fslib/vfatlib/check/boot.c b/sdk/lib/fslib/vfatlib/check/boot.c
index 2c8681bbce3..5bd1a4657e7 100644
--- a/sdk/lib/fslib/vfatlib/check/boot.c
+++ b/sdk/lib/fslib/vfatlib/check/boot.c
@@ -26,6 +26,9 @@
* by Roman Hodek <Roman.Hodek(a)informatik.uni-erlangen.de> */
#include "vfatlib.h"
+#ifdef __REACTOS__
+#include <ntstrsafe.h>
+#endif // __REACTOS__
#define NDEBUG
#include <debug.h>
@@ -170,7 +173,11 @@ static void check_backup_boot(DOS_FS * fs, struct boot_sector *b,
unsigned int l
for (p = (uint8_t *) b, q = (uint8_t *) & b2, i = 0; i < sizeof(b2);
++p, ++q, ++i) {
if (*p != *q) {
+#ifndef __REACTOS__
sprintf(buf, "%s%u:%02x/%02x", first ? "" : ", ",
+#else
+ RtlStringCbPrintfA(buf, sizeof(buf), "%s%u:%02x/%02x", first ? "" :
", ",
+#endif // __REACTOS__
(unsigned)(p - (uint8_t *) b), *p, *q);
if (pos + strlen(buf) > 78)
printf("\n "), pos = 2;