mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
MINOR: ring: always check that the old ring fits in the new one in ring_dup()
Let's add a BUG_ON() to make sure we don't accidentally shrink a buffer.
This commit is contained in:
parent
3ef7daa731
commit
4615cb510c
1 changed files with 2 additions and 0 deletions
|
|
@ -102,6 +102,8 @@ static inline size_t ring_dup(struct ring *dst, const struct ring *src, size_t m
|
|||
if (max > ring_data(src))
|
||||
max = ring_data(src);
|
||||
|
||||
BUG_ON(max > ring_size(dst));
|
||||
|
||||
vp_peek_ofs(v1, v2, 0, ring_area(dst), max);
|
||||
dst->storage->head = 0;
|
||||
dst->storage->tail = max;
|
||||
|
|
|
|||
Loading…
Reference in a new issue