diff --git a/libavformat/dashdec.c b/libavformat/dashdec.c
index 9ae28491e1ecd..41311d6e8f931 100644
--- a/libavformat/dashdec.c
+++ b/libavformat/dashdec.c
@@ -805,8 +805,10 @@ static int resolve_content_path(AVFormatContext *s, const char *url, int *max_ur
memset(p + 1, 0, strlen(p));
}
av_strlcat(tmp_str, text + start, tmp_max_url_size);
- xmlNodeSetContent(baseurl_nodes[i], tmp_str);
+ xmlChar *escaped = xmlEncodeSpecialChars(NULL, tmp_str);
+ xmlNodeSetContent(baseurl_nodes[i], escaped);
updated = 1;
+ xmlFree(escaped);
xmlFree(text);
}
}