Fix segfault with some very short fragments
This commit is contained in:
parent
f1499f602e
commit
ac03052f22
1 changed files with 10 additions and 0 deletions
|
@ -2140,6 +2140,16 @@ static void ssl_bitmask_set( unsigned char *mask, size_t offset, size_t len )
|
|||
{
|
||||
size_t first_byte_idx = offset / 8;
|
||||
|
||||
/* Special case */
|
||||
if( len <= start_bits )
|
||||
{
|
||||
for( ; len != 0; len-- )
|
||||
mask[first_byte_idx] |= 1 << ( start_bits - len );
|
||||
|
||||
/* Avoid potential issues with offset or len becoming invalid */
|
||||
return;
|
||||
}
|
||||
|
||||
offset += start_bits; /* Now offset % 8 == 0 */
|
||||
len -= start_bits;
|
||||
|
||||
|
|
Loading…
Reference in a new issue