[xiph-commits] r14491 - trunk/icecast2yp/src
karl at svn.xiph.org
karl at svn.xiph.org
Tue Feb 12 14:07:01 PST 2008
Author: karl
Date: 2008-02-12 14:07:01 -0800 (Tue, 12 Feb 2008)
New Revision: 14491
Modified:
trunk/icecast2yp/src/yp_cgi.c
Log:
avoid trying some known invalid listenurls and add checks for UTF8 on passed
strings, blanking them if required
Modified: trunk/icecast2yp/src/yp_cgi.c
===================================================================
--- trunk/icecast2yp/src/yp_cgi.c 2008-02-12 21:48:09 UTC (rev 14490)
+++ trunk/icecast2yp/src/yp_cgi.c 2008-02-12 22:07:01 UTC (rev 14491)
@@ -103,6 +103,8 @@
if (ptmp) {
strncpy(server_name, ptmp, sizeof(server_name)-1);
free(ptmp);
+ if (xmlCheckUTF8 ((unsigned char *)server_name) == 0)
+ server_name [0] = '\0';
}
}
@@ -113,6 +115,8 @@
if (ptmp) {
strncpy(genre, ptmp, sizeof(genre)-1);
free(ptmp);
+ if (xmlCheckUTF8 ((unsigned char *)genre) == 0)
+ genre [0] = '\0';
}
}
if (cgi_param("cpswd") != NULL) {
@@ -131,6 +135,8 @@
if (ptmp) {
strncpy(desc, cgi_param("desc"), sizeof(desc)-1);
free(ptmp);
+ if (xmlCheckUTF8 ((unsigned char *)desc) == 0)
+ desc [0] = '\0';
}
}
if (cgi_param("url") != NULL) {
@@ -153,11 +159,21 @@
p1 = listenurl + strlen("http://localhost");
use_listingIP = 1;
}
+ if (!strncmp(listenurl, "http://127.", strlen("http://127."))) {
+ p1 = listenurl + strlen("http://127.");
+ p1 = strchr(p1, ':');
+ use_listingIP = 1;
+ }
if (!strncmp(listenurl, "http://192.168.", strlen("http://192.168."))) {
p1 = listenurl + strlen("http://192.168.");
p1 = strchr(p1, ':');
use_listingIP = 1;
}
+ if (!strncmp(listenurl, "http://(null)", strlen("http://(null)"))) {
+ p1 = listenurl + strlen("http://(null)");
+ p1 = strchr(p1, ':');
+ use_listingIP = 1;
+ }
if (use_listingIP) {
if (p1) {
snprintf(listenurl2, sizeof(listenurl2)-1, "http://%s%s", listing_ip, p1);
@@ -306,6 +322,9 @@
if (ptmp) {
strncpy(st, ptmp, sizeof(st)-1);
free(ptmp);
+ /* non UTF8 chars, allow touch to work but use a blank string */
+ if (xmlCheckUTF8 ((unsigned char *)st) == 0)
+ st [0] = '\0';
}
}
if (cgi_param("listeners") != NULL) {
More information about the commits
mailing list