[PATCH 3/3] libdvbv5: fix array size in desc_logical_channel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This fixes the descriptor paring on 64bit systems.
Thanks to abassetta@xxxxxxxxxx for finding and patching.

Signed-off-by: André Roth <neolynx@xxxxxxxxx>
---
 lib/libdvbv5/descriptors/desc_logical_channel.c | 4 ++--
 lib/libdvbv5/dvb-file.c                         | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libdvbv5/descriptors/desc_logical_channel.c b/lib/libdvbv5/descriptors/desc_logical_channel.c
index 7ae4d59a..1a8dc658 100644
--- a/lib/libdvbv5/descriptors/desc_logical_channel.c
+++ b/lib/libdvbv5/descriptors/desc_logical_channel.c
@@ -40,7 +40,7 @@ int dvb_desc_logical_channel_init(struct dvb_v5_fe_parms *parms,
 
 	memcpy(d->lcn, p, d->length);
 
-	len = d->length / sizeof(d->lcn);
+	len = d->length / 4;
 
 	for (i = 0; i < len; i++) {
 		bswap16(d->lcn[i].service_id);
@@ -55,7 +55,7 @@ void dvb_desc_logical_channel_print(struct dvb_v5_fe_parms *parms, const struct
 	int i;
 	size_t len;
 
-	len = d->length / sizeof(d->lcn);
+	len = d->length / 4;
 
 	for (i = 0; i < len; i++) {
 		dvb_loginfo("|           service ID[%d]     %d", i, d->lcn[i].service_id);
diff --git a/lib/libdvbv5/dvb-file.c b/lib/libdvbv5/dvb-file.c
index ffdfe292..d077271a 100644
--- a/lib/libdvbv5/dvb-file.c
+++ b/lib/libdvbv5/dvb-file.c
@@ -987,7 +987,7 @@ static char *dvb_vchannel(struct dvb_v5_fe_parms_priv *parms,
 		size_t len;
 		int r;
 
-		len = d->length / sizeof(d->lcn);
+		len = d->length / 4;
 		for (i = 0; i < len; i++) {
 			if (service_id == d->lcn[i].service_id) {
 				r = asprintf(&buf, "%d.%d",
-- 
2.17.1




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux