# HG changeset patch # User mjsousa # Date 1622622193 -3600 # Node ID 6f6451e78531607a2d47932c5add90e6e016c090 # Parent 7c955a1d39e8d8090ec8a89e6277cab945e74e21 fix bug with receive buffer handling. Was causing data corruption during communication errors with long frames. diff -r 7c955a1d39e8 -r 6f6451e78531 mb_ds_util.h --- a/mb_ds_util.h Mon Jun 01 14:28:49 2020 +0100 +++ b/mb_ds_util.h Wed Jun 02 09:23:13 2021 +0100 @@ -122,9 +122,12 @@ } static inline u8 *lb_normalize(lb_buf_t *buf) { - return (u8 *)memmove(buf->data, - buf->data + buf->data_start, - buf->data_end - buf->data_start); + u8 *ptr = (u8 *)memmove(buf->data, + buf->data + buf->data_start, + buf->data_end - buf->data_start); + buf->data_end -= buf->data_start; + buf->data_start = 0; + return ptr; } static inline u8 *lb_data(lb_buf_t *buf) {