nhttpd: change sprintf to snprintf

This commit is contained in:
Jacek Jendrzej
2015-03-31 14:44:41 +02:00
parent 2c3ecf6183
commit 0f2ac568c8
3 changed files with 5 additions and 5 deletions

View File

@@ -1958,7 +1958,7 @@ void CControlAPI::SendTimers(CyhookHandler *hh)
"Unknown TV-Channel" : "Unknown Radio-Channel");
}
else
sprintf(zAddData, PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer->channel_id);
snprintf(zAddData,sizeof(zAddData), PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS, timer->channel_id);
zAddData[22]=0;
@@ -1966,7 +1966,7 @@ void CControlAPI::SendTimers(CyhookHandler *hh)
case CTimerd::TIMER_STANDBY:
if (!send_id)
sprintf(zAddData,"Standby: %s",(timer->standby_on ? "ON" : "OFF"));
snprintf(zAddData,sizeof(zAddData),"Standby: %s",(timer->standby_on ? "ON" : "OFF"));
break;
case CTimerd::TIMER_REMIND :

View File

@@ -300,11 +300,11 @@ std::string CNeutrinoYParser::func_get_channels_as_dropdown(CyhookHandler *, st
CEPGData epg;
CZapitChannel * channel = channels[j];
char buf[100],id[20];
sprintf(id,PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->getChannelID());
snprintf(id,sizeof(id),PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS,channel->getChannelID());
std::string _sid = std::string(id);
sel = (_sid == achannel_id) ? "selected=\"selected\"" : "";
CEitManager::getInstance()->getActualEPGServiceKey(channel->getChannelID(), &epg);
sprintf(buf,"<option value=" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s>%.20s - %.30s</option>\n", channel->getChannelID(), sel.c_str(), channel->getName().c_str(),epg.title.c_str());
snprintf(buf,sizeof(buf),"<option value=" PRINTF_CHANNEL_ID_TYPE_NO_LEADING_ZEROS " %s>%.20s - %.30s</option>\n", channel->getChannelID(), sel.c_str(), channel->getName().c_str(),epg.title.c_str());
yresult += buf;
}
}