mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
core/ringbuffer: compensate 'ringbuffer_remove' underflow error
When rb->start = rb->size, `ringbuffer_get_one(ringbuffer_t *restrict rb)` will read out of bounds.
This commit is contained in:
parent
0d4d621f99
commit
7f44c02f45
@ -121,7 +121,7 @@ unsigned ringbuffer_remove(ringbuffer_t *restrict rb, unsigned n)
|
||||
rb->avail -= n;
|
||||
|
||||
/* compensate underflow */
|
||||
if (rb->start > rb->size) {
|
||||
if (rb->start >= rb->size) {
|
||||
rb->start -= rb->size;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user