https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6129fbaf1eb936bff9ef49c5a28b854b62dc96d1

commit 6129fbaf1eb936bff9ef49c5a28b854b62dc96d1
Author:     Timo Kreuzer <[email protected]>
AuthorDate: Sun Apr 28 21:03:35 2019 +0200
Commit:     HervĂ© Poussineau <[email protected]>
CommitDate: Mon May 27 13:22:40 2019 +0200

    [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 82716f61b5..239fd3465c 100644
--- a/base/setup/usetup/usetup.c
+++ b/base/setup/usetup/usetup.c
@@ -27,6 +27,7 @@
 
 #include <usetup.h>
 #include <math.h>
+#include <ntstrsafe.h>
 
 #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),

Reply via email to