diff options
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-02-22 17:30:13 +0100
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-02-22 17:30:13 +0100
commit20876adf568c31ec6c446892ce8b6e2f650f5035 (patch)
parent868ca548b10a4c3c49d114734053a22c974ff7a6 (diff)
libdvbv5: avoid a potential access out of an array
In practice, this condition is very unlikely to occur, as it would depend on upgrading a Kernel with a newer DTV property while using an older v4l-utils package. As we don't add any new DTV property for quite a while, I would say that only if someone would run a brand new v4l2-utils and a very old Kernel (like 2.6.x), something like that would happen. In any case, better to be safe than sorry. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index 866e4c6c..4a004284 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -74,8 +74,12 @@ int dvb_store_entry_prop(struct dvb_entry *entry,
if (i == entry->n_props) {
if (i == DTV_MAX_COMMAND) {
- fprintf(stderr, _("Can't add property %s\n"),
- dvb_v5_name[cmd]);
+ if (cmd < ARRAY_SIZE(dvb_v5_name))
+ fprintf(stderr, _("Can't add property %s\n"),
+ dvb_v5_name[cmd]);
+ else
+ fprintf(stderr, _("Can't add property %d\n"),
+ cmd);
return -1;

Privacy Policy