Update libmodbus to address CVE-2022-0367#3
Merged
Conversation
When compiling with gcc and option -Wconversion it fixes the
warning message
warning: conversion from ‘X’ {aka ‘x’} to ‘Y’ {aka ‘y’} may change value
Signed-off-by: José Bollo <jose.bollo@iot.bzh>
There is a small typo in tests/bandwidth-client.c. Should read `response` rather than `reponse`.
Add Embox RTOS to the list of supported OSes
Thanks to @peternewman
) While handling MODBUS_FC_WRITE_AND_READ_REGISTERS, both address offsets must be checked, i.e. the read and the write address must be within the mapping range. At the moment, only the read address was considered, it looks like a simple copy and paste error, so let's fix it. Signed-off-by: Michael Heimpold <mhei@heimpold.de>
Sorry for the two PRs, I did one then realized I should check the other
This native libmodbus error code is defined but not used.
…tephane#665, stephane#694) * Removes useless memcpy calls and no longer used swap32 and swap16 macros. * Updated float encoding functions to consider endianess of 16-bit registers (fixes stephane#665) * Deprecated modbus_get_float() and modbus_set_float() are implemented using cdab variants.
…ixes stephane#665, stephane#694)" This reverts commit 13bd584.
CID 416366: INTEGER_OVERFLOW found with Coverity Scan.
The modbus_reply function is designed to receive arguments from modbus_receive. This patch avoid a wrong use of memcpy if the user chooses to inject a bad length argument. Thank you Nozomi Networks Labs Advisory for the report.
- rename internal *_prepare_response_tid to *_get_response_tid - change signature, don't need req length anymore - remove misleading modification of req_length - check of req length before use in memcpy for mask write register Related to df79a02
…ix test suite and setter functions. This reverts commit 49af73d.
The default port number of Modbus is 502 but it requires privileges on Linux.
Ziink4
approved these changes
Sep 1, 2025
Collaborator
Ziink4
left a comment
There was a problem hiding this comment.
LGTM, can you open a PR on NEUWeb with the updated submodule to make sure all CI tests are green ?
Ziink4
requested changes
Sep 1, 2025
Collaborator
There was a problem hiding this comment.
/usr/bin/gcc-13 -DDLLBUILD -DHAVE_CONFIG_H -D_CRT_NONSTDC_NO_DEPRECATE=1 -D_CRT_SECURE_NO_DEPRECATE=1 -Dlibmodbus_EXPORTS -I/home/jenkins/workspace/NEUWeb_PR-904/build/external/libmodbus/src -I/home/jenkins/workspace/NEUWeb_PR-904/external/libmodbus/src -O3 -DNDEBUG -fPIC -MD -MT external/libmodbus/CMakeFiles/libmodbus.dir/src/modbus-tcp.c.o -MF external/libmodbus/CMakeFiles/libmodbus.dir/src/modbus-tcp.c.o.d -o external/libmodbus/CMakeFiles/libmodbus.dir/src/modbus-tcp.c.o -c /home/jenkins/workspace/NEUWeb_PR-904/external/libmodbus/src/modbus-tcp.c
/home/jenkins/workspace/NEUWeb_PR-904/external/libmodbus/src/modbus-tcp.c: In function '_modbus_tcp_set_ipv4_options':
/home/jenkins/workspace/NEUWeb_PR-904/external/libmodbus/src/modbus-tcp.c:266:14: error: 'IPTOS_LOWDELAY' undeclared (first use in this function)
266 | option = IPTOS_LOWDELAY;
| ^~~~~~~~~~~~~~
/home/jenkins/workspace/NEUWeb_PR-904/external/libmodbus/src/modbus-tcp.c:266:14: note: each undeclared identifier is reported only once for each function it appears in
We might need to adjust our CMakeLists, I think that we blindly use the config.h.win32 template for both windows and Linux, and it seems that it disables some linux specific macros needed by this commit : stephane@ae6f327
The way to do this would be to generate a linux config.h using the autoconf instructions on their repo, and add it to our fork as a separate config.h.unix
… HAVE_NETINET_IP_H directly in modbus-tcp.c for Linux builds to force including <netinet/ip.h> which provides IPTOS_LOWDELAY definition
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge tag 'v3.1.11'