Fidonet Portal






From: Andrew Alt (1:261/38)
To: All
Date: Wed, 03.03.21 12:15
rmw compile warnings
-=> Maurice Kinal wrote to Andrew Alt <=-

MK> -={ 2021-03-01 17:54:39.246915930+00:00 }=-

MK> Hey Andrew!

MK> The above was done on my custom pure 64-bit nondistribution rootfs (aka
MK> motorshed) using gcc-10.2.0/glibc-2.33 and friends.

MK> Does this help any?

Hi, Maurice!

On Debian with gcc 8 I wasn't getting any warnings. So.. that reminds me I
might have
to make some changes to get rid of those warnings. Smile I'm not really sure of
the best
way to fix those though. I have mixed feelings about using snprintf(Wink. I have
redundant checks in place to check string lengths before concatenating, and I
don't
want strings to just get truncated. rmw is designed to exit (without a
segfault) with
a message if a buffer overflow is attempted. I think I should just change all
my
snprintf(Wink statements to sprintf(Wink... Which probably won't fix the warnings you

mentioned, lol ;)


I can get even more if I use CFLAGS="-Wformat -Wstringop-truncation
-Wformat-overflow=2 -pedantic -Wextra -Wformat-truncation=2" Smile

Any suggestions? Probably if don't set fixed lengths in the structures and
instead
use calloc(Wink at the time when I concatenate and write the final string, that
would
get rid of some of these annoying messages I get when I use the flags mentioned

above. Seems like that would require a lot of extra manual memory management
though.
Things are working fine right now so I'm reluctant to change the code until I
really
understand well how best to fix those warnings.

CC main.o
../../rmw/src/main.c: In function ? ?remove_to_waste? ?:
../../rmw/src/main.c:422:101: warning: ? ?%s? ? directive output between 0 and
4096 bytes may exceed minimum required size of 4095 [-Wformat-truncation=]
tf (st_file_properties.waste_dest_name, sizeof
(st_file_properties.waste_dest_name), "%s%s",

^~

../../rmw/src/main.c:422:100: note: assuming directive output of 1 byte
tf (st_file_properties.waste_dest_name, sizeof
(st_file_properties.waste_dest_name), "%s%s",

^~~~~~

../../rmw/src/main.c:422:9: note: ? ?snprintf? ? output 1 or more bytes
(assuming 4098) into a destination of size 4097
snprintf (st_file_properties.waste_dest_name, sizeof
(st_file_properties.waste_dest_name), "%s%s",

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
waste_curr->files, st_file_properties.base_name);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC restore_rmw.o
../../rmw/src/restore_rmw.c: In function ? ?restore? ?:
../../rmw/src/restore_rmw.c:72:47: warning: ? ?%s? ? directive output between 0
and 4096 bytes may exceed minimum required size of 4095 [-Wformat-truncation=]
snprintf (file.info, sizeof (file.info), "%s%s%s%s", file.relative_path,
file.relative_info_path,
^~ ~~~~~~~~~~~~~~~~~~
../../rmw/src/restore_rmw.c:72:46: note: assuming directive output of 1 byte
snprintf (file.info, sizeof (file.info), "%s%s%s%s", file.relative_path,
file.relative_info_path,
^~~~~~~~~~
../../rmw/src/restore_rmw.c:72:5: note: ? ?snprintf? ? output 11 or more bytes
(assuming 4116) into a destination of size 4097
snprintf (file.info, sizeof (file.info), "%s%s%s%s", file.relative_path,
file.relative_info_path,

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
file.base_name, TRASHINFO_EXT);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../rmw/src/restore_rmw.c: In function ? ?restore_select? ?:
../../rmw/src/restore_rmw.c:364:59: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
snprintf (recover_file, sizeof (recover_file), "%s%s",
waste_curr->files, item_name (items[i]Wink);
^~
../../rmw/src/restore_rmw.c:364:58: note: assuming directive output of 1 byte
snprintf (recover_file, sizeof (recover_file), "%s%s",
waste_curr->files, item_name (items[i]Wink);
^~~~~~
../../rmw/src/restore_rmw.c:364:11: note: ? ?snprintf? ? output 1 or more bytes
(assuming 4098) into a destination of size 4097
snprintf (recover_file, sizeof (recover_file), "%s%s",
waste_curr->files, item_name (items[i]Wink);

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~
../../rmw/src/restore_rmw.c:244:38: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
snprintf (full_path, req_len, "%s%s", waste_curr->files, entry->d_name);
^~
CC config_rmw.o
../../rmw/src/config_rmw.c: In function ? ?parse_line_waste? ?:
../../rmw/src/config_rmw.c:306:42: warning: ? ?%s? ? directive output between 0
and 4096 bytes may exceed minimum required size of 4095 [-Wformat-truncation=]
snprintf (waste_curr->files, req_len, "%s%s", waste_curr->parent,
"/files/");
^~
../../rmw/src/config_rmw.c:324:41: warning: ? ?%s? ? directive output between 0
and 4096 bytes may exceed minimum required size of 4095 [-Wformat-truncation=]
snprintf (waste_curr->info, req_len, "%s%s", waste_curr->parent, "/info/");
^~
CC parse_cli_options.o
CC strings_rmw.o
CC purging_rmw.o
../../rmw/src/purging_rmw.c: In function ? ?purge? ?:
../../rmw/src/purging_rmw.c:332:18: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
"%s%s", waste_curr->info, st_trashinfo_dir_entry->d_name);
^~
../../rmw/src/purging_rmw.c: In function ? ?orphan_maint? ?:
../../rmw/src/purging_rmw.c:562:46: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
snprintf (path_to_trashinfo, req_len, "%s%s%s", waste_curr->info,
^~
../../rmw/src/purging_rmw.c:562:45: note: assuming directive output of 1 byte
snprintf (path_to_trashinfo, req_len, "%s%s%s", waste_curr->info,
^~~~~~~~
../../rmw/src/purging_rmw.c:574:57: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
snprintf (st_file_properties.real_path, req_len, "%s%s%s",
^~
../../rmw/src/purging_rmw.c:574:56: note: assuming directive output of 1 byte
snprintf (st_file_properties.real_path, req_len, "%s%s%s",
^~~~~~~~
CC messages_rmw.o
CC time_rmw.o
CC trashinfo_rmw.o
../../rmw/src/trashinfo_rmw.c:31:36: warning: initializer element is not a
constant expression [-Wpedantic]
const int LEN_MAX_TRASHINFO_LINE = (PATH_MAX * 3 + strlen ("Path=") + 1);
^
../../rmw/src/trashinfo_rmw.c: In function ? ?create_trashinfo? ?:
../../rmw/src/trashinfo_rmw.c:47:40: warning: ? ?%s? ? directive output between
0 and 4096 bytes may exceed minimum required size of 4095
[-Wformat-truncation=]
snprintf (final_info_dest, req_len, "%s%s", waste_curr->info,
st_f_props->base_name);
^~
../../rmw/src/trashinfo_rmw.c:47:39: note: assuming directive output of 1 byte
snprintf (final_info_dest, req_len, "%s%s", waste_curr->info,
st_f_props->base_name);
^~~~~~
CC utils_rmw.o
../../rmw/src/utils_rmw.c: In function ? ?unescape_url? ?:
../../rmw/src/utils_rmw.c:317:35: warning: format ? ?%hhx? ? expects argument
of type ? ?unsigned char *? ?, but argument 3 has type ? ?char *? ? [-Wformat=]
sscanf (str + pos_str, "%2hhx", dest + pos_dest);
~~~~^ ~~~~~~~~~~~~~~~
%2hhx
../../rmw/src/utils_rmw.c: In function ? ?human_readable_size? ?:
../../rmw/src/utils_rmw.c:143:44: warning: ? ? B? ? directive output may be
truncated writing 2 bytes into a region of size between 0 and 19
[-Wformat-truncation=]
snprintf (buffer, sizeof (buffer), "%ld B", (long) size);
^~
../../rmw/src/utils_rmw.c:143:5: note: ? ?snprintf? ? output between 4 and 23
bytes into a destination of size 20
snprintf (buffer, sizeof (buffer), "%ld B", (long) size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../rmw/src/utils_rmw.c:140:44: warning: ? ?.? ? directive output may be
truncated writing 1 byte into a region of size between 0 and 19
[-Wformat-truncation=]
snprintf (buffer, sizeof (buffer), "%ld.%d %ciB", (long) size,
^
../../rmw/src/utils_rmw.c:140:5: note: ? ?snprintf? ? output between 8 and 37
bytes into a destination of size 20
snprintf (buffer, sizeof (buffer), "%ld.%d %ciB", (long) size,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(remainder * 10) / 1024, prefix[power]);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CC bst.o
CCLD ../rmw

--
-Andy


... A few feathers short of a whole duck.
-+- MultiMail/Linux v0.52

--- BBBS/Li6 v4.10 Toy-5
* Origin: Prism bbs (1:261/38)

ABOUT

This forum contains echomail areas hosted on Nightmare BBS You can browse local echomail areas, italian fidonet areas and a selection of international fidonet areas, reading messages posted by users in Nightmare BBS or even other BBSs all over the world. You can find file areas too (functional to fidonet technology). You can browse echomail areas and download files with no registration, but if you want to write messages in echomail areas, or use fidonet netmail (private messages with fidomet technology), you have to register. Only a minimal set of data is required, functional to echomail and netmail usage (name, password, email); a registration and login with facebook is provided too, to allow easy registration. If you won't follow rules (each echomail areas has its own, regularly posted in the echomail), your account may be suspended;

CONTACT