mirror of
https://github.com/tuxbox-neutrino/neutrino.git
synced 2025-08-27 15:32:59 +02:00
gui/subchannel_select.cpp: fix possible format-overflow error
error was: '%s' directive writing up to 49 bytes into a region of size between 48 and 97 [-Werror=format-overflow=] sprintf(nvod_s, "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x);
This commit is contained in:
@@ -67,7 +67,7 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu)
|
|||||||
|
|
||||||
for ( CSubServiceListSorted::iterator e=g_RemoteControl->subChannels.begin(); e!=g_RemoteControl->subChannels.end(); ++e)
|
for ( CSubServiceListSorted::iterator e=g_RemoteControl->subChannels.begin(); e!=g_RemoteControl->subChannels.end(); ++e)
|
||||||
{
|
{
|
||||||
sprintf(nvod_id, "%d", count);
|
snprintf(nvod_id, sizeof(nvod_id), "%d", count);
|
||||||
|
|
||||||
t_channel_id subid = e->getChannelID();
|
t_channel_id subid = e->getChannelID();
|
||||||
bool enabled = CRecordManager::getInstance()->SameTransponder(subid);
|
bool enabled = CRecordManager::getInstance()->SameTransponder(subid);
|
||||||
@@ -79,27 +79,27 @@ int CSubChannelSelectMenu::getNVODMenu(CMenuWidget* menu)
|
|||||||
struct tm *tmZeit;
|
struct tm *tmZeit;
|
||||||
|
|
||||||
tmZeit= localtime(&e->startzeit);
|
tmZeit= localtime(&e->startzeit);
|
||||||
sprintf(nvod_time_a, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
|
snprintf(nvod_time_a, sizeof(nvod_time_a), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
|
||||||
|
|
||||||
time_t endtime = e->startzeit+ e->dauer;
|
time_t endtime = e->startzeit+ e->dauer;
|
||||||
tmZeit= localtime(&endtime);
|
tmZeit= localtime(&endtime);
|
||||||
sprintf(nvod_time_e, "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
|
snprintf(nvod_time_e, sizeof(nvod_time_e), "%02d:%02d", tmZeit->tm_hour, tmZeit->tm_min);
|
||||||
|
|
||||||
time_t jetzt=time(NULL);
|
time_t jetzt=time(NULL);
|
||||||
if (e->startzeit > jetzt)
|
if (e->startzeit > jetzt)
|
||||||
{
|
{
|
||||||
int mins=(e->startzeit- jetzt)/ 60;
|
int mins=(e->startzeit- jetzt)/ 60;
|
||||||
sprintf(nvod_time_x, g_Locale->getText(LOCALE_NVOD_STARTING), mins);
|
snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_STARTING), mins);
|
||||||
}
|
}
|
||||||
else if ( (e->startzeit<= jetzt) && (jetzt < endtime) )
|
else if ( (e->startzeit<= jetzt) && (jetzt < endtime) )
|
||||||
{
|
{
|
||||||
int proz=(jetzt- e->startzeit)*100/ e->dauer;
|
int proz=(jetzt- e->startzeit)*100/ e->dauer;
|
||||||
sprintf(nvod_time_x, g_Locale->getText(LOCALE_NVOD_PERCENTAGE), proz);
|
snprintf(nvod_time_x, sizeof(nvod_time_x), g_Locale->getText(LOCALE_NVOD_PERCENTAGE), proz);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nvod_time_x[0]= 0;
|
nvod_time_x[0]= 0;
|
||||||
|
|
||||||
sprintf(nvod_s, "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x);
|
snprintf(nvod_s, sizeof(nvod_s), "%s - %s %s", nvod_time_a, nvod_time_e, nvod_time_x);
|
||||||
menu->addItem(new CMenuForwarder(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel));
|
menu->addItem(new CMenuForwarder(nvod_s, enabled, NULL, &NVODChanger, nvod_id), (count == g_RemoteControl->selected_subchannel));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user