Slave address in build_request_packet_tcp() is hardcoded as 0xFF

Bug #181887 reported by Nicodemmus
2
Affects Status Importance Assigned to Milestone
libmodbus
Fix Released
High
Stéphane Raimbault

Bug Description

I am using version 1.2.2 of libmodbus and I noticed that there is a problem in the following function:

int build_request_packet_tcp(int slave, int function, int start_addr, int count, unsigned char *packet)

The problem is that the slave address is hardcoded as 0xFF, thus ignoring the function argument "int slave" when creating the package.

Line 209 is as follows:

packet[6] = 0xFF;

and it should be :

packet[6] = slave;

Regards.

Related branches

Revision history for this message
Stéphane Raimbault (sra) wrote :

Thank you for your bug report.
I previously did this change in trunk, I will change the stable version too.
This error came from a bad documentation about the Modbus protocol.

Changed in libmodbus:
assignee: nobody → sra
importance: Undecided → High
milestone: none → 1.2.3
status: New → Fix Committed
Changed in libmodbus:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.