summaryrefslogtreecommitdiff
authorMichael Niedermayer <michaelni@gmx.at>2013-10-08 22:30:46 (GMT)
committer Michael Niedermayer <michaelni@gmx.at>2013-10-08 22:30:46 (GMT)
commit885739f3b4ca3fb60abf417120845e3fcfb99b53 (patch)
tree54b707cd25fcdb30d06a8db940696865453f218f
parent60136345e68066a8d75dcf5f3b2bcf2c91fc000e (diff)
downloadffmpeg-885739f3b4ca3fb60abf417120845e3fcfb99b53.zip
ffmpeg-885739f3b4ca3fb60abf417120845e3fcfb99b53.tar.gz
ffmpeg-885739f3b4ca3fb60abf417120845e3fcfb99b53.tar.bz2
ffserver: strip odd chars from html error messages before sending them back
Fixes Ticket3034 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat
-rw-r--r--ffserver.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ffserver.c b/ffserver.c
index 6aaaeaf..5ecdb08 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -327,6 +327,14 @@ static AVLFG random_state;
static FILE *logfile = NULL;
+static void htmlstrip(char *s) {
+ while (s && *s) {
+ s += strspn(s, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,. ");
+ if (*s)
+ *s++ = '?';
+ }
+}
+
static int64_t ffm_read_write_index(int fd)
{
uint8_t buf[8];
@@ -1886,6 +1894,7 @@ static int http_parse_request(HTTPContext *c)
send_error:
c->http_error = 404;
q = c->buffer;
+ htmlstrip(msg);
snprintf(q, c->buffer_size,
"HTTP/1.0 404 Not Found\r\n"
"Content-type: text/html\r\n"