aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-10-09 00:30:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-01-16 00:35:12 +0100
commitda82be0cc00c195ffb890207db3a7608a97f2ac0 (patch)
tree6f6d209486de8b3d012ea72927adc0a96f219c70
parentb8b77aefe89438b86d47dfd7c78d541eed0bd2a9 (diff)
downloadffmpeg-da82be0cc00c195ffb890207db3a7608a97f2ac0.tar.gz
ffserver: strip odd chars from html error messages before sending them back
Fixes Ticket3034 Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 885739f3b4ca3fb60abf417120845e3fcfb99b53) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--ffserver.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/ffserver.c b/ffserver.c
index eee83e5695..97906a2444 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"