Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/modbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,12 @@ int modbus_reply(modbus_t *ctx,
sft.function = function;
sft.t_id = ctx->backend->get_response_tid(req);

if (slave != 0 && slave != 255) {
errno = EINVAL;
printf("The Unit Identifier must be 0x00 or 0xFF\n");
return -1;
}

/* Data are flushed on illegal number of values errors. */
switch (function) {
case MODBUS_FC_READ_COILS:
Expand Down