sectionsd: -fix possible buf overflow & skip read EPG cache if index.tmp available

git-svn-id: file:///home/bas/coolstream_public_svn/THIRDPARTY/applications/neutrino-beta@2122 e54a6e83-5905-42d5-8d5c-058d10e6a962


Origin commit data
------------------
Branch: ni/coolstream
Commit: a397eaef58
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2012-02-25 (Sat, 25 Feb 2012)



------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2012-02-25 18:11:19 +00:00
parent 94eda3b351
commit 71e542ceaa

View File

@@ -4582,13 +4582,21 @@ static void *insertEventsfromFile(void *)
t_original_network_id onid = 0;
t_transport_stream_id tsid = 0;
t_service_id sid = 0;
char cclass[20];
char cuser[20];
char cclass[20]={0};
char cuser[20]={0};;
std::string indexname;
std::string filename;
std::string epgname;
int ev_count = 0;
struct stat buf;
indexname = epg_dir + "index.tmp";
//skip read EPG cache if index.tmp available
if (stat(indexname.c_str(), &buf) == 0){
reader_ready = true;
pthread_exit(NULL);
}
indexname = epg_dir + "index.xml";
xmlDocPtr index_parser = parseXmlFile(indexname.c_str());
@@ -4672,12 +4680,14 @@ static void *insertEventsfromFile(void *)
node = node->xmlNextNode;
}
int count = 0;
unsigned int count = 0;
while (xmlGetNextOccurence(node, "content") != NULL) {
cclass[count] = xmlGetNumericAttribute(node, "class", 16);
cuser[count] = xmlGetNumericAttribute(node, "user", 16);
node = node->xmlNextNode;
count++;
if(count > sizeof(cclass)-1)
break;
}
e.contentClassification = std::string(cclass, count);
e.userClassification = std::string(cuser, count);