Commit 5fd7ec5c1d268ddd74997c458210a4bfcf31359a
1 parent
5f77c114
Fix too short uint8_t for rsp_length (bug introduced by 018cdd6)
Showing
1 changed file
with
2 additions
and
4 deletions
src/modbus.c
| @@ -107,9 +107,7 @@ int modbus_flush(modbus_t *ctx) | @@ -107,9 +107,7 @@ int modbus_flush(modbus_t *ctx) | ||
| 107 | static unsigned int compute_response_length_from_request(modbus_t *ctx, uint8_t *req) | 107 | static unsigned int compute_response_length_from_request(modbus_t *ctx, uint8_t *req) |
| 108 | { | 108 | { |
| 109 | int length; | 109 | int length; |
| 110 | - int offset; | ||
| 111 | - | ||
| 112 | - offset = ctx->backend->header_length; | 110 | + const int offset = ctx->backend->header_length; |
| 113 | 111 | ||
| 114 | switch (req[offset]) { | 112 | switch (req[offset]) { |
| 115 | case _FC_READ_COILS: | 113 | case _FC_READ_COILS: |
| @@ -450,7 +448,7 @@ int modbus_receive_confirmation(modbus_t *ctx, uint8_t *rsp) | @@ -450,7 +448,7 @@ int modbus_receive_confirmation(modbus_t *ctx, uint8_t *rsp) | ||
| 450 | } | 448 | } |
| 451 | 449 | ||
| 452 | static int check_confirmation(modbus_t *ctx, uint8_t *req, | 450 | static int check_confirmation(modbus_t *ctx, uint8_t *req, |
| 453 | - uint8_t *rsp, uint8_t rsp_length) | 451 | + uint8_t *rsp, int rsp_length) |
| 454 | { | 452 | { |
| 455 | int rc; | 453 | int rc; |
| 456 | int rsp_length_computed; | 454 | int rsp_length_computed; |