Home » U++ Library support » U++ Core » Warning in Log.cpp
Warning in Log.cpp [message #54466] |
Tue, 28 July 2020 08:52 |
pvictor
Messages: 67 Registered: December 2015
|
Member |
|
|
GCC 9.3.0 issues the next warning:
/tmp/upp/uppsrc/Core/Log.cpp: In member function 'void Upp::LogOut::Create(bool)':
/tmp/upp/uppsrc/Core/Log.cpp:136:56: warning: '%s' directive writing up to 499 bytes into a region of size between 452 and 970 [-Wformat-overflow=]
136 | sprintf(h, "* %s %02d.%02d.%04d %02d:%02d:%02d, user: %s\n",
| ^~
137 | FromSysChrSet(exe),
138 | t.day, t.month, t.year, t.hour, t.minute, t.second, user);
| ~~~~
In file included from /usr/include/stdio.h:867,
from /tmp/upp/uppsrc/Core/Core.h:58:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:34: note: '__builtin___sprintf_chk' output between 32 and 1049 bytes into a destination of size 1000
36 | return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37 | __bos (__s), __fmt, __va_arg_pack ());
It's enough to increase the size of array: char h[1000] -> char h[1052]
to eliminate the warning.
Best regards.
Victor
|
|
|
|
Goto Forum:
Current Time: Sun Jun 16 14:55:57 CEST 2024
Total time taken to generate the page: 0.02836 seconds
|