From 770de32f1908b1f9c60f66bf288a4c8a03f97d52 Mon Sep 17 00:00:00 2001 From: Johann Friedrichs Date: Thu, 11 Apr 2019 14:13:08 +0200 Subject: Fix possible format overflow and avoid compiler warning --- menu_conflictcheck.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/menu_conflictcheck.c b/menu_conflictcheck.c index 3e03cfe..01340f8 100644 --- a/menu_conflictcheck.c +++ b/menu_conflictcheck.c @@ -164,10 +164,10 @@ bool cMenuConflictCheckDetailsItem::Update(bool Force) hasTimer = timerObj->OrigTimer(Timers) ? timerObj->OrigTimer(Timers)->HasFlags(tfActive) : false; if (Force || hasTimer != oldhasTimer) { const cTimer* timer = timerObj->timer; - char device[2] = ""; + char device[3] = ""; // compiler warns if MAXDEVICES too big if (hasTimer) { if (!timerObj->conflCheckTime && timerObj->device > -1) - sprintf(device, "%d", timerObj->device + 1); + sprintf(device, "%d", (timerObj->device + 1)&MAXDEVICES); else { if (timer->Local()) strcpy(device, tr("C")); @@ -176,7 +176,6 @@ bool cMenuConflictCheckDetailsItem::Update(bool Force) } } -// cString buffer = cString::sprintf("%s\t%s\t%d\t%s - %s\t%d\t%s\t%s", hasTimer?">":"", timer->Remote()?timer->Remote():"", timer->Channel()->Number(), TIMESTRING(timerObj->start), TIMESTRING(timerObj->stop), timer->Priority(), device, timer->File()); cString buffer = cString::sprintf("%s\t%d\t%s - %s\t%d\t%s\t%s", hasTimer ? ">" : "", timer->Channel()->Number(), TIMESTRING(timerObj->start), TIMESTRING(timerObj->stop), timer->Priority(), device, timer->File()); SetText(buffer); -- cgit v1.2.3