Commit e1eb3e50 authored by Nils Goroll's avatar Nils Goroll Committed by Pål Hermunn Johansen

Fix an off-by-one when setting the first bit exceeding the current bitmap size

When setting bit n (the n+1th bit) of an n-bit vbitmap, we'd miss to
expand the bitmap and thus overflow our buffer and overwrite the first
bit of the next byte in memory.
parent fb04e4c4
......@@ -86,7 +86,7 @@ vbit_set(struct vbitmap *vb, unsigned bit)
{
if (bit >= vb->nbits)
vbit_expand(vb, bit);
vbit_expand(vb, bit + 1);
vb->bits[VBITMAP_IDX(bit)] |= VBITMAP_BIT(bit);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment