[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);
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 20:38:25 +02:00
parent ddb56e8cca
commit b275f24406

View file

@ -26,6 +26,9 @@
* by Roman Hodek <Roman.Hodek@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;