Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Warning in Log.cpp
Warning in Log.cpp [message #54466] Tue, 28 July 2020 08:52 Go to next message
pvictor is currently offline  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
Re: Warning in Log.cpp [message #54470 is a reply to message #54466] Tue, 28 July 2020 17:47 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, applied.
Previous Topic: [SOLVED] ParseJSON weird behaviour
Next Topic: clamp() function crashes apps on Linux, gets warning from GCC and CLANG
Goto Forum:
  


Current Time: Fri Apr 19 15:18:07 CEST 2024

Total time taken to generate the page: 0.07473 seconds