Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Bug in nrf_ringbuf_cpy_get

I think I found a bug in nrf_ringbuf_cpy_get. The first memcpy is wrong. The source and destination should be swapped.

    if (length > trail)
    {
        memcpy(&p_ringbuf->p_buffer[masked_rd_idx], p_data, trail);
        length -= trail;
        masked_rd_idx = 0;
       p_data += trail;
   }
   memcpy(p_data, &p_ringbuf->p_buffer[masked_rd_idx], length);
   p_ringbuf->p_cb->rd_idx += *p_length;

Related