From 15f13ac9363990df26b93ddf198c56a702cd659e Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Wed, 7 Dec 2022 09:38:05 +0100 Subject: [PATCH] Avoiding a zero sized array in cDevice::GetDevice() --- CONTRIBUTORS | 1 + HISTORY | 3 ++- device.c | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 54c55d57..5ca7e14d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -2209,6 +2209,7 @@ Marko M for avoiding the memcpy() call in cGlyph::cGlyph() if the bitmap is empty for avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there are no areas + for avoiding a zero sized array in cDevice::GetDevice() Patrick Rother for reporting a bug in defining timers that only differ in the day of week diff --git a/HISTORY b/HISTORY index eccc607e..5553a43c 100644 --- a/HISTORY +++ b/HISTORY @@ -9816,7 +9816,7 @@ Video Disk Recorder Revision History - Added missing rounding when dividing frequencies in processing the NIT (thanks to Winfried Köhler). -2022-12-06: +2022-12-07: - Fixed a compiler warning. - Fixed generating the index file in the cutter (reported by Christoph Haubrich). @@ -9830,3 +9830,4 @@ Video Disk Recorder Revision History to Marko Mäkelä). - Now avoiding unnecessary processing in cDvbSubtitleConverter::FinishPage() if there are no areas (thanks to Marko Mäkelä). +- Avoiding a zero sized array in cDevice::GetDevice() (thanks to Marko Mäkelä). diff --git a/device.c b/device.c index 4b9c9cc7..9d70d20c 100644 --- a/device.c +++ b/device.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: device.c 5.5 2022/01/24 16:53:45 kls Exp $ + * $Id: device.c 5.6 2022/12/07 09:38:05 kls Exp $ */ #include "device.h" @@ -249,7 +249,7 @@ cDevice *cDevice::GetDevice(const cChannel *Channel, int Priority, bool LiveView { // Collect the current priorities of all CAM slots that can decrypt the channel: int NumCamSlots = CamSlots.Count(); - int SlotPriority[NumCamSlots]; + int SlotPriority[NumCamSlots + 1]; // +1 to avoid a zero sized array in case there are no CAM slots int NumUsableSlots = 0; bool InternalCamNeeded = false; if (Channel->Ca() >= CA_ENCRYPTED_MIN) {