]> git.sesse.net Git - ffmpeg/commitdiff
ffserver: strip odd chars from html error messages before sending them back
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Oct 2013 22:30:46 +0000 (00:30 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 8 Oct 2013 22:30:46 +0000 (00:30 +0200)
Fixes Ticket3034

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ffserver.c

index 6aaaeaf79c0aea3b377760d6a86b2014171ec722..5ecdb08d387726f41b2891173827e978712860a5 100644 (file)
@@ -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"