Skip to content

Commit d6657a2

Browse files
committed
zchunk: fix bounds check in getuint
1 parent bf5cd0d commit d6657a2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

ext/solv_zchunk.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,27 +58,27 @@ getuint(unsigned char *p, unsigned char *endp, unsigned int *dp)
5858
{
5959
if (!p || p >= endp)
6060
return 0;
61-
if (p <= endp && (*p & 0x80) != 0)
61+
if (p < endp && (*p & 0x80) != 0)
6262
{
6363
*dp = p[0] ^ 0x80;
6464
return p + 1;
6565
}
66-
if (++p <= endp && (*p & 0x80) != 0)
66+
if (++p < endp && (*p & 0x80) != 0)
6767
{
6868
*dp = p[-1] ^ ((p[0] ^ 0x80) << 7);
6969
return p + 1;
7070
}
71-
if (++p <= endp && (*p & 0x80) != 0)
71+
if (++p < endp && (*p & 0x80) != 0)
7272
{
7373
*dp = p[-2] ^ (p[-1] << 7) ^ ((p[0] ^ 0x80) << 14);
7474
return p + 1;
7575
}
76-
if (++p <= endp && (*p & 0x80) != 0)
76+
if (++p < endp && (*p & 0x80) != 0)
7777
{
7878
*dp = p[-3] ^ (p[-2] << 7) ^ (p[1] << 14) ^ ((p[0] ^ 0x80) << 21);
7979
return p + 1;
8080
}
81-
if (++p <= endp && (*p & 0xf0) == 0x80)
81+
if (++p < endp && (*p & 0xf0) == 0x80)
8282
{
8383
*dp = p[-4] ^ (p[-3] << 7) ^ (p[2] << 14) ^ (p[1] << 21) ^ ((p[0] ^ 0x80) << 28);
8484
return p + 1;

0 commit comments

Comments
 (0)