can-utils/isobusfs
Oleksij Rempel 8012b3b23d isobusfs: address snprintf truncation warning with explicit limits
Modify the isobusfs_log function in isobusfs_cmn.c to explicitly limit
the lengths of the time_buffer, level_str, and log_entry strings in
the snprintf format string to 40, 10, and 150 characters respectively.
This change acknowledges that truncation may still occur, but it is now
explicit and controlled.

This change silences the following warning:
cmake -DCMAKE_BUILD_TYPE=Debug -D CMAKE_C_COMPILER=gcc -B build
cmake --build build

/home/isobusfs/isobusfs_cmn.c: In function 'isobusfs_log':
/home/isobusfs/isobusfs_cmn.c:104:30: warning: '%s' directive output
may be truncated writing up to 191 bytes into a region of size between
182 and 245 [-Wformat-truncation=]
  104 |                  "[%s] [%s]: %s", time_buffer, level_str, log_entry);
      |                              ^~                           ~~~~~~~~~
/home/isobusfs/isobusfs_cmn.c:103:9: note: 'snprintf' output 12 or more
bytes (assuming 266) into a destination of size 256
  103 |         snprintf(complete_log_entry, sizeof(complete_log_entry),
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104 |                  "[%s] [%s]: %s", time_buffer, level_str, log_entry);
      |                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
2024-05-29 10:54:18 +02:00
..
isobusfs_cli.c isobusfs: do not kill application on error_queue error 2024-05-25 07:57:16 +02:00
isobusfs_cli.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cli_cm.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cli_dh.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cli_fa.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cli_int.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cli_selftests.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn.c isobusfs: address snprintf truncation warning with explicit limits 2024-05-29 10:54:18 +02:00
isobusfs_cmn.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn_cm.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn_dh.c Fixes musl build for ARMv7 2024-02-20 11:06:13 +01:00
isobusfs_cmn_dh.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn_fa.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn_fh.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_cmn_va.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_create_test_dirs.sh isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_create_test_file.sh isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_srv.c isobusfs: do not kill application on error_queue error 2024-05-25 07:57:16 +02:00
isobusfs_srv.h isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_srv_cm.c isobusfs_srv_cm: do not try to add padding beyond the buffer 2024-05-25 07:57:16 +02:00
isobusfs_srv_cm_fss.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_srv_dh.c can-utils: fix sign-compare warnings (#513) 2024-04-24 20:02:02 +02:00
isobusfs_srv_fa.c can-utils: fix sign-compare warnings (#513) 2024-04-24 20:02:02 +02:00
isobusfs_srv_fh.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00
isobusfs_srv_vh.c isobusfs: change license to LGPL-2.0-only 2024-02-04 19:15:25 +01:00