mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-09-13 21:21:12 +00:00
0f1fde850f
More recent g++ versions produce these warnings: test_PasswordRAMStore.cc: In member function ‘virtual void GParted::PasswordRAMStoreTest_TotalErasure_Test::TestBody()’: test_PasswordRAMStore.cc:61:32: warning: ‘ ’ directive output truncated writing 20 bytes into a region of size 10 [-Wformat-truncation=] snprintf( buf, sizeof( buf ), "password%03u ", i ); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ test_PasswordRAMStore.cc:61:10: note: ‘snprintf’ output 32 bytes into a destination of size 21 snprintf( buf, sizeof( buf ), "password%03u ", i ); ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ snprintf() [1] truncates the printed string to the specified size so didn't overflow the buffer. However clear the warning by making the formatted string always exactly 20 characters long, followed by the terminating NUL character to exactly fill the buffer. [1] print3(f) - Linux manual page https://man7.org/linux/man-pages/man3/snprintf.3.html "The functions snprintf() and vsnprintf() write at most size bytes (including the terminating null byte ('\0')) to str. " |
||
---|---|---|
.. | ||
common.cc | ||
common.h | ||
exclude_loopdev_tests.sh | ||
insertion_operators.cc | ||
insertion_operators.h | ||
makedev.sh | ||
Makefile.am | ||
test_BlockSpecial.cc | ||
test_dummy.cc | ||
test_EraseFileSystemSignatures.cc | ||
test_PasswordRAMStore.cc | ||
test_PipeCapture.cc | ||
test_SupportedFileSystems.cc |