Skip to content

Commit 24d8771

Browse files
SilverPlate3mchehab
authored andcommitted
media: dvb-net: fix OOB access in ULE extension header tables
The ule_mandatory_ext_handlers[] and ule_optional_ext_handlers[] tables in handle_one_ule_extension() are declared with 255 elements (valid indices 0-254), but the index htype is derived from network-controlled data as (ule_sndu_type & 0x00FF), giving a range of 0-255. When htype equals 255, an out-of-bounds read occurs on the function pointer table, and the OOB value may be called as a function pointer. Add a bounds check on htype against the array size before either table is accessed. Out-of-range values now cause the SNDU to be discarded. Fixes: 1da177e ("Linux-2.6.12-rc2") Reported-by: Ariel Silver <[email protected]> Signed-off-by: Ariel Silver <[email protected]> Cc: [email protected] Signed-off-by: Mauro Carvalho Chehab <[email protected]>
1 parent 6de23f8 commit 24d8771

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/media/dvb-core/dvb_net.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,9 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
228228
unsigned char hlen = (p->ule_sndu_type & 0x0700) >> 8;
229229
unsigned char htype = p->ule_sndu_type & 0x00FF;
230230

231+
if (htype >= ARRAY_SIZE(ule_mandatory_ext_handlers))
232+
return -1;
233+
231234
/* Discriminate mandatory and optional extension headers. */
232235
if (hlen == 0) {
233236
/* Mandatory extension header */

0 commit comments

Comments
 (0)