From 6129fbaf1eb936bff9ef49c5a28b854b62dc96d1 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Sun, 28 Apr 2019 21:03:35 +0200 Subject: [PATCH] [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); ~~~~~~~~~~~~~~~~~~~~~~ --- base/setup/usetup/usetup.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/base/setup/usetup/usetup.c b/base/setup/usetup/usetup.c index 82716f61b5b..239fd3465ce 100644 --- a/base/setup/usetup/usetup.c +++ b/base/setup/usetup/usetup.c @@ -27,6 +27,7 @@ #include #include +#include #include "bootsup.h" #include "chkdsk.h" @@ -3403,12 +3404,13 @@ CheckFileSystemPage(PINPUT_RECORD Ir) */ PartEntry->NeedsCheck = FALSE; - 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); + RtlStringCbPrintfA(Buffer, + sizeof(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); PopupError(Buffer, MUIGetString(STRING_QUITCONTINUE),