mirror of
https://github.com/reactos/reactos.git
synced 2025-05-17 16:27:00 +00:00
- Don't calculate remaining bits if there are none. Fixes out-of-bounds read of a buffer.
- Patch sent to Wine: http://www.winehq.org/pipermail/wine-patches/2008-December/066692.html svn path=/trunk/; revision=38324
This commit is contained in:
parent
ebef3e5d4e
commit
16726f509e
1 changed files with 6 additions and 3 deletions
|
@ -764,9 +764,12 @@ RtlNumberOfSetBits(PRTL_BITMAP BitMapHeader)
|
|||
lpOut++;
|
||||
}
|
||||
|
||||
bMasked = *lpOut & NTDLL_maskBits[ulRemainder];
|
||||
ulSet += NTDLL_nibbleBitCount[bMasked >> 4];
|
||||
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf];
|
||||
if (ulRemainder)
|
||||
{
|
||||
bMasked = *lpOut & NTDLL_maskBits[ulRemainder];
|
||||
ulSet += NTDLL_nibbleBitCount[bMasked >> 4];
|
||||
ulSet += NTDLL_nibbleBitCount[bMasked & 0xf];
|
||||
}
|
||||
}
|
||||
return ulSet;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue