[USETUP] Use RtlStringCbPrintfA instead of sprintf

Fixes GCC 8 warning:
base/setup/usetup/usetup.c:3407:78: error: '%S' directive writing up to 521 bytes into a region of size 200 [-Werror=format-overflow=]
                 "Setup is currently unable to check a partition formatted in %S.\n"
                                                                              ^~
base/setup/usetup/usetup.c:3406:9: note: 'sprintf' output between 128 and 649 bytes into a destination of size 260
         sprintf(Buffer,
         ^~~~~~~~~~~~~~~
                 "Setup is currently unable to check a partition formatted in %S.\n"
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 "\n"
                 ~~~~
                 "  \x07  Press ENTER to continue Setup.\n"
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 "  \x07  Press F3 to quit Setup.",
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                 PartEntry->FileSystem);
                 ~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Timo Kreuzer 2019-04-28 21:03:35 +02:00 committed by Hervé Poussineau
parent ead2156a29
commit 6129fbaf1e

View file

@ -27,6 +27,7 @@
#include <usetup.h> #include <usetup.h>
#include <math.h> #include <math.h>
#include <ntstrsafe.h>
#include "bootsup.h" #include "bootsup.h"
#include "chkdsk.h" #include "chkdsk.h"
@ -3403,12 +3404,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir)
*/ */
PartEntry->NeedsCheck = FALSE; PartEntry->NeedsCheck = FALSE;
sprintf(Buffer, RtlStringCbPrintfA(Buffer,
"Setup is currently unable to check a partition formatted in %S.\n" sizeof(Buffer),
"\n" "Setup is currently unable to check a partition formatted in %S.\n"
" \x07 Press ENTER to continue Setup.\n" "\n"
" \x07 Press F3 to quit Setup.", " \x07 Press ENTER to continue Setup.\n"
PartEntry->FileSystem); " \x07 Press F3 to quit Setup.",
PartEntry->FileSystem);
PopupError(Buffer, PopupError(Buffer,
MUIGetString(STRING_QUITCONTINUE), MUIGetString(STRING_QUITCONTINUE),