Fix potential memory overflow in welcome string

stage1.c:354:41: warning: '%s' directive output may be truncated writing up to 127 bytes into a region of size 117 [-Wformat-truncation=]
  snprintf(buf, sizeof(buf), "Welcome to %s", version);
                                         ^~   ~~~~~~~
In file included from /usr/include/stdio.h:862,
                 from stage1.c:30:
/usr/include/bits/stdio2.h:64:10: note: '__builtin___snprintf_chk' output between 12 and 139 bytes into a destination of size 128
   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        __bos (__s), __fmt, __va_arg_pack ());
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This commit is contained in:
Evgeny Sinelnikov 2021-04-04 17:34:46 +04:00
parent 7a21d264c7
commit bcc496411b

View File

@ -340,7 +340,7 @@ void getversion()
void stage1()
{
enum return_type ret;
char buf[128];
char buf[256];
char *init;
open_log();