[FFmpeg-cvslog] ffserver: strip odd chars from html error messages before sending them back

Michael Niedermayer git at videolan.org
Fri Oct 11 15:26:42 CEST 2013


ffmpeg | branch: release/1.1 | Michael Niedermayer <michaelni at gmx.at> | Wed Oct  9 00:30:46 2013 +0200| [2a7bdbf67efbb7061957f52ef81f49e6c06cfd54] | committer: Michael Niedermayer

ffserver: strip odd chars from html error messages before sending them back

Fixes Ticket3034

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 885739f3b4ca3fb60abf417120845e3fcfb99b53)

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

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2a7bdbf67efbb7061957f52ef81f49e6c06cfd54
---

 ffserver.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/ffserver.c b/ffserver.c
index f2cf67f..9b2ce99 100644
--- a/ffserver.c
+++ b/ffserver.c
@@ -328,6 +328,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];
@@ -1887,6 +1895,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"



More information about the ffmpeg-cvslog mailing list