aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-02-23 14:18:07 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-02-23 14:18:07 +0100
commitdfb5ab3d63c3c96b774f660c4fa3a25c095bd690 (patch)
tree40e25a2796458e4d4bc78f5db631a9cc635ebe4e
parentd9da94a07885334bafcaabb46823de627dd4eb46 (diff)
libdvbv5: desc_language: check if the size is correct
Reject it when the size doesn't match what's expected. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
-rw-r--r--lib/libdvbv5/descriptors/desc_language.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/libdvbv5/descriptors/desc_language.c b/lib/libdvbv5/descriptors/desc_language.c
index fd4e57ab..ae1f1c7e 100644
--- a/lib/libdvbv5/descriptors/desc_language.c
+++ b/lib/libdvbv5/descriptors/desc_language.c
@@ -28,6 +28,15 @@
int dvb_desc_language_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc)
{
struct dvb_desc_language *lang = (struct dvb_desc_language *) desc;
+ size_t len, dlen = desc->length;
+
+ len = sizeof(lang->language) - 1 + sizeof(lang->audio_type);
+
+ if (len != dlen) {
+ dvb_logwarn("language descriptor size is wrong: expected %zu, received %zu",
+ len, dlen);
+ return -1;
+ }
lang->language[0] = buf[0];
lang->language[1] = buf[1];

Privacy Policy