Commit be75324e authored by Karl Heyes's avatar Karl Heyes

update for win32 build. Allow for more source stats and add boundary check

svn path=/icecast/trunk/icecast/; revision=13547
parent f1c6cf9d
...@@ -43,7 +43,7 @@ CString gConfigurationSave; ...@@ -43,7 +43,7 @@ CString gConfigurationSave;
char gTitleSource[1024] = ""; char gTitleSource[1024] = "";
char gTitleName[1024] = ""; char gTitleName[1024] = "";
#define MAXSTATSPERSOURCE 30 #define MAXSTATSPERSOURCE 60
#define MAXSOURCES 1024 #define MAXSOURCES 1024
typedef struct tagElement { typedef struct tagElement {
...@@ -472,6 +472,8 @@ void AddUpdateStatistic(int sourceIndex, char *name, char *value) ...@@ -472,6 +472,8 @@ void AddUpdateStatistic(int sourceIndex, char *name, char *value)
} }
} }
int numStats = gStats[sourceIndex].numStats; int numStats = gStats[sourceIndex].numStats;
if (numStats >= MAXSTATSPERSOURCE)
return;
/* If we get here, we haven't found the stat, so add it */ /* If we get here, we haven't found the stat, so add it */
gStats[sourceIndex].stats[numStats].name = name; gStats[sourceIndex].stats[numStats].name = name;
gStats[sourceIndex].stats[numStats].value = value; gStats[sourceIndex].stats[numStats].value = value;
...@@ -488,6 +490,8 @@ int GetSourceIndex(char *sourceName) ...@@ -488,6 +490,8 @@ int GetSourceIndex(char *sourceName)
return i; return i;
} }
} }
if (numMainStats >= MAXSOURCES)
return 0;
/* This means we haven't seen the source, so lets add it */ /* This means we haven't seen the source, so lets add it */
numMainStats++; numMainStats++;
gStats[numMainStats].source = sourceName; gStats[numMainStats].source = sourceName;
...@@ -537,7 +541,7 @@ void StartStats(void *dummy) ...@@ -537,7 +541,7 @@ void StartStats(void *dummy)
xmlDocPtr doc; xmlDocPtr doc;
stats_get_xml(&doc, 0); stats_get_xml(&doc, 0, NULL);
xmlNodePtr cur; xmlNodePtr cur;
cur = xmlDocGetRootElement(doc); cur = xmlDocGetRootElement(doc);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment