]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: dvb-net: fix OOB access in ULE extension header tables
authorAriel Silver <arielsilver77@gmail.com>
Sat, 21 Feb 2026 14:26:00 +0000 (15:26 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Fri, 27 Feb 2026 09:57:48 +0000 (10:57 +0100)
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: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Reported-by: Ariel Silver <arielsilver77@gmail.com>
Signed-off-by: Ariel Silver <arielsilver77@gmail.com>
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/dvb-core/dvb_net.c

index 8bb8dd34c223e91119059965851de57cac9af8e5..a2159b2bc176649b38a9e08ca1586b7de597f80c 100644 (file)
@@ -228,6 +228,9 @@ static int handle_one_ule_extension( struct dvb_net_priv *p )
        unsigned char hlen = (p->ule_sndu_type & 0x0700) >> 8;
        unsigned char htype = p->ule_sndu_type & 0x00FF;
 
+       if (htype >= ARRAY_SIZE(ule_mandatory_ext_handlers))
+               return -1;
+
        /* Discriminate mandatory and optional extension headers. */
        if (hlen == 0) {
                /* Mandatory extension header */