summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-31 15:36:07 +0100
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-31 15:36:07 +0100
commit935d4a59bd44068c60f471f5cb336fc17f93b6dd (patch)
tree54ef3e302d6d1eb93e43da6be9e57660f36beaa7
parent86572db549eeab513eceac393d7620e7ea6e03ff (diff)
owfd: rtsp: ignore binary 0
Ignore binary 0 under all circumstances. It's just braindead to use it in ASCII protocols. Turn escape sequences into "\0" so a tokenizer won't have to deal with it. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/rtsp_decoder.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rtsp_decoder.c b/src/rtsp_decoder.c
index b64b1bf..260802b 100644
--- a/src/rtsp_decoder.c
+++ b/src/rtsp_decoder.c
@@ -200,10 +200,17 @@ static size_t sanitize_header_line(struct owfd_rtsp_decoder *dec,
if (quoted) {
if (prev == '\\' && !escaped) {
escaped = 1;
+ /* turn escaped binary zero into "\0" */
+ if (c == '\0')
+ c = '0';
} else {
escaped = 0;
- if (c == '"')
+ if (c == '"') {
quoted = 0;
+ } else if (c == '\0') {
+ /* skip binary 0 */
+ continue;
+ }
}
} else {
/* ignore any binary 0 */