In spop_get_varint(), -1 is returned if there is not enough data in the
buffer to decode the variable integer. However a strict comparison agasint
b_data() was performed, which is wrong. A failure must be reported if the
index is greater or equal to b_data().
This patch must be backported as far as 3.2.
size_t idx = o;
int r;
- if (idx > b_data(b))
+ if (idx >= b_data(b))
return -1;
p = (unsigned char *)b_peek(b, idx++);
r = 4;
do {
- if (idx > b_data(b))
+ if (idx >= b_data(b))
return -1;
p = (unsigned char *)b_peek(b, idx++);
*i += (uint64_t)*p << r;