Fix segfault with some very short fragments

This commit is contained in:
Manuel Pégourié-Gonnard 2014-09-02 14:23:40 +02:00 committed by Paul Bakker
parent f1499f602e
commit ac03052f22

View file

@ -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;