Skip to content

Commit

Permalink
Merge pull request #15 from mgduda/use_memmove_fix
Browse files Browse the repository at this point in the history
Switch from memcpy to memmove when copying within buffers
  • Loading branch information
Noltari authored Jan 31, 2023
2 parents 9d05ed4 + 67ce071 commit ca81e5c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uart-bridge.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ void usb_write_bytes(uint8_t itf)

count = tud_cdc_n_write(itf, ud->uart_buffer, ud->uart_pos);
if (count < ud->uart_pos)
memcpy(ud->uart_buffer, &ud->uart_buffer[count],
memmove(ud->uart_buffer, &ud->uart_buffer[count],
ud->uart_pos - count);
ud->uart_pos -= count;

Expand Down Expand Up @@ -245,7 +245,7 @@ void uart_write_bytes(uint8_t itf)
}

if (count < ud->usb_pos)
memcpy(ud->usb_buffer, &ud->usb_buffer[count],
memmove(ud->usb_buffer, &ud->usb_buffer[count],
ud->usb_pos - count);
ud->usb_pos -= count;

Expand Down

0 comments on commit ca81e5c

Please sign in to comment.