From e9b2e0e718b29114bc9bdd5347ca8db3e8a00eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20P=C3=B6schel?= Date: Fri, 16 Dec 2022 11:34:39 +0100 Subject: [PATCH] check FE/CA array size upon init --- lib/src/ca.c | 3 +++ lib/src/dvb.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/lib/src/ca.c b/lib/src/ca.c index 9c38caa..72f2a31 100644 --- a/lib/src/ca.c +++ b/lib/src/ca.c @@ -631,6 +631,9 @@ static int init_ca(struct dddvb *dd, int a, int f, int fd) struct dddvb_ca *ca; char fname[80]; + if (dd->dvbca_num >= DDDVB_MAX_DVB_CA) + return -1; + ca = &dd->dvbca[dd->dvbca_num]; ca->dd = dd; ca->anum = a; diff --git a/lib/src/dvb.c b/lib/src/dvb.c index b639078..a7b9586 100644 --- a/lib/src/dvb.c +++ b/lib/src/dvb.c @@ -798,6 +798,9 @@ static int dddvb_fe_init(struct dddvb *dd, int a, int f, int fd) int r; uint32_t i, ds; + if (dd->dvbfe_num >= DDDVB_MAX_DVB_FE) + return -1; + fe = &dd->dvbfe[dd->dvbfe_num]; r = snprintf(fe->name, sizeof(fe->name), "/dev/dvb/adapter%d/frontend%d", a, f);