Skip to content

Instantly share code, notes, and snippets.

@rojer
Created February 12, 2024 14:33
Show Gist options
  • Save rojer/76819527895acb16b0ea69b9778f6b5a to your computer and use it in GitHub Desktop.
Save rojer/76819527895acb16b0ea69b9778f6b5a to your computer and use it in GitHub Desktop.
[rojer@nbd ~]$ git clone https://github.com/debevv/nanoMODBUS
Cloning into 'nanoMODBUS'...
remote: Enumerating objects: 1345, done.
remote: Counting objects: 100% (362/362), done.
remote: Compressing objects: 100% (128/128), done.
remote: Total 1345 (delta 238), reused 301 (delta 215), pack-reused 983
Receiving objects: 100% (1345/1345), 23.07 MiB | 8.89 MiB/s, done.
Resolving deltas: 100% (748/748), done.
[rojer@nbd ~]$ cd nanoMODBUS/
[rojer@nbd ~/nanoMODBUS master]$ clang-tidy-15 nanomodbus.c
Error while trying to load a compilation database:
Could not auto-detect compilation database for file "nanomodbus.c"
No compilation database found in /home/rojer/nanoMODBUS or any parent directory
fixed-compilation-database: Error while opening fixed database: No such file or directory
json-compilation-database: Error while opening JSON database: No such file or directory
Running without flags.
474 warnings generated.
/home/rojer/nanoMODBUS/nanomodbus.c:97:5: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecure
API.DeprecatedOrUnsafeBufferHandling]
memcpy(&nmbs->msg.buf[nmbs->msg.buf_idx], data, size);
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:97:5: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(&nmbs->msg.buf[nmbs->msg.buf_idx], data, size);
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:167:5: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insecur
eAPI.DeprecatedOrUnsafeBufferHandling]
memset(nmbs, 0, sizeof(nmbs_t));
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:167:5: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
memset(nmbs, 0, sizeof(nmbs_t));
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:703:9: warning: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11 [clang-analyzer-security.insecur
eAPI.DeprecatedOrUnsafeBufferHandling]
memcpy(registers, subreq_record_data, subreq_data_size);
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:703:9: note: Call to function 'memcpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memcpy_s' in case of C11
memcpy(registers, subreq_record_data, subreq_data_size);
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:833:13: warning: Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'strncpy_s' in case of C11 [clang-analyzer-security.inse
cureAPI.DeprecatedOrUnsafeBufferHandling]
strncpy(buffers_out[buf_index], str, buffers_length);
^~~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:833:13: note: Call to function 'strncpy' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'strncpy_s' in case of C11
strncpy(buffers_out[buf_index], str, buffers_length);
^~~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:1616:13: warning: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11 [clang-analyzer-security.insec
ureAPI.DeprecatedOrUnsafeBufferHandling]
nmbs_bitfield_reset(map);
^
/home/rojer/nanoMODBUS/nanomodbus.h:116:33: note: expanded from macro 'nmbs_bitfield_reset'
#define nmbs_bitfield_reset(bf) memset(bf, 0, sizeof(bf))
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:1616:13: note: Call to function 'memset' is insecure as it does not provide security checks introduced in the C11 standard. Replace with analogous functions that support length arguments or provides boundary checks such as 'memset_s' in case of C11
nmbs_bitfield_reset(map);
^
/home/rojer/nanoMODBUS/nanomodbus.h:116:33: note: expanded from macro 'nmbs_bitfield_reset'
#define nmbs_bitfield_reset(bf) memset(bf, 0, sizeof(bf))
^~~~~~
/home/rojer/nanoMODBUS/nanomodbus.c:1713:33: warning: narrowing conversion from 'int' to signed type 'int16_t' (aka 'short') is implementation-defined [bugprone-narrowing-conversions]
res_size_left = res_size_left - 2 - str_len;
^
/home/rojer/nanoMODBUS/nanomodbus.h:447:12: warning: function 'nmbs_read_device_identification_basic' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
nmbs_error nmbs_read_device_identification_basic(nmbs_t* nmbs, char* vendor_name, char* product_code,
^
/home/rojer/nanoMODBUS/nanomodbus.c:2182:12: note: the definition seen here
nmbs_error nmbs_read_device_identification_basic(nmbs_t* nmbs, char* vendor_name, char* product_code,
^
/home/rojer/nanoMODBUS/nanomodbus.h:447:12: note: differing parameters are named here: ('buffer_length'), in definition: ('buffers_length')
nmbs_error nmbs_read_device_identification_basic(nmbs_t* nmbs, char* vendor_name, char* product_code,
^
/home/rojer/nanoMODBUS/nanomodbus.h:460:12: warning: function 'nmbs_read_device_identification_regular' has a definition with different parameter names [readability-inconsistent-declaration-parameter-name]
nmbs_error nmbs_read_device_identification_regular(nmbs_t* nmbs, char* vendor_url, char* product_name, char* model_name,
^
/home/rojer/nanoMODBUS/nanomodbus.c:2218:12: note: the definition seen here
nmbs_error nmbs_read_device_identification_regular(nmbs_t* nmbs, char* vendor_url, char* product_name, char* model_name,
^
/home/rojer/nanoMODBUS/nanomodbus.h:460:12: note: differing parameters are named here: ('buffer_length'), in definition: ('buffers_length')
nmbs_error nmbs_read_device_identification_regular(nmbs_t* nmbs, char* vendor_url, char* product_name, char* model_name,
^
Suppressed 466 warnings (466 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
[rojer@nbd ~/nanoMODBUS master]$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment