libmodbus 3.2.0 (2026-07-02)
- Add
modbus_proxy()to bridge two Modbus backends (closes #70). - Add termios2 support to allow custom baud rates (RTU).
- Return an exception response for READ EXCEPTION STATUS (0x07).
- Use
EMBXILVALinstead ofEMBMDATAfor illegal data value errors. modbus_reply: reject NULLreqandmb_mappingarguments.modbus_reply: validate request length before reading per-function fields.- Fix signed integer overflow in
modbus_get_float_*()(reported by Dominik
Blain and Henrik Brodin). - Fix signed integer overflow in the
MODBUS_GET_INT*_FROM_INT*macros;
MODBUS_GET_INT16_FROM_INT8()now returns a signedint16_tin every context
(reported by Henrik Brodin - Trail of Bits). - Fix strict aliasing violation in
modbus_set_float_*()by usingmemcpy
(reported by Henrik Brodin). - Remove dead code (Coverity CID 561619).
- modbus-rtu: don't use
O_EXCLwhen opening the device (#760). - WIN32 compatibility for
setsockopt()in modbus-tcp.c (#800). - Check if
ai_listis null before freeing it (#831). - Respect user-provided CFLAGS (closes #836).
- Fix test to use
ctxinstead ofinvalid_ctx(closes #791, #792). - Update documentation of float functions (closes #838).
- Fix documentation examples of
modbus_get_float_*functions. modbus_reply_exception: reject a NULL request pointer.modbus_mask_write_register: validate thatctxis not NULL.modbus_write_and_read_registers: validatesrc/destpointers and counts.modbus_report_slave_id: reject a NULLdestbuffer.modbus_get_*_timeout: validate that the output pointers are not NULL.modbus_mapping_new_start_address: cap table dimensions.modbus_mapping_new: reject negative counts.modbus_rtu_set_custom_rts: reject a NULL callback.- modbus-rtu: avoid integer overflow in the RTS post-send delay.
- modbus-rtu: check the return values of the RTS ioctl calls.
- modbus-rtu: check the return value when saving termios settings on connect.
- modbus-rtu: report a failure to restore termios settings on close.
modbus_new_rtu: reject negative baud rates.- modbus-tcp: guard
freeaddrinfo()against NULL on resolver failure. modbus_new_tcp: NUL-terminate the IP string whenipis NULL.modbus_reply: validate FC22 request length before writing the register.- modbus-tcp: keep
ctx->sconsistent across failed or repeated connects (no
false success on a stale descriptor, no socket leak on reconnect). - modbus-tcp: don't override the user error recovery mode in the flush overflow
path. - modbus-tcp: fully initialize the sigaction struct for the SIGPIPE handler on
BSD. - modbus-rtu: fix the Windows serial handle lifecycle (initialize the handle,
guard close against a never-opened handle and reset it after close). - modbus-rtu: sleep the RTS turnaround delay in chunks to stay portable with
usleep(). modbus_new_rtu: validatedata_bitandstop_bitarguments.modbus_send_raw_request_tid: reject NULLraw_reqwithEINVAL.modbus_get_byte_from_bits: remove an always-false assert and clampnb_bits
consistently in debug and release builds.- Preserve errno across the Windows error-recovery paths.
- tests: don't kill the unit test server on RTU bad-CRC frames.
- tests: fix integer overflow in the bandwidth-client rate computation.
New Contributors
- @micrictor made their first contribution in #831
- @desteemy made their first contribution in #800
Full Changelog: v3.1.12...v3.2.0