From b275f24406b70ae0d9a9e9d21b70b8bdcbcc3bce Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 28 Apr 2019 20:38:25 +0200 Subject: [PATCH] [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 */ #include "vfatlib.h" +#ifdef __REACTOS__ +#include +#endif // __REACTOS__ #define NDEBUG #include @@ -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;