vlc | branch: master | Barmand Toumiret <[email protected]> | Wed Jul 24 00:09:44 2019 +0800| [787a20665af9e075cec39e03408b42b4e9032fe7] | committer: Rémi Denis-Courmont
sdp: fix null format string passed to vsnprintf When rtcp-mux is used, sdp_AddAttribute is called with a null format string, which means to write an SDP property attribute (without value), which is a different from an empty format string, that writes an SDP value attribute with an empty value. This fixes vsdp_AddAttribute so that it correctly writes a property attribute to the SDP description rather than incorrectly calling vsnprintf with a null format string (an undefined behaviour which segfaults on Windows) and writing a value attribute with an empty value. Signed-off-by: Rémi Denis-Courmont <[email protected]> > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=787a20665af9e075cec39e03408b42b4e9032fe7 --- src/stream_output/sdp.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/stream_output/sdp.c b/src/stream_output/sdp.c index c57c6117fc..dc13ec0601 100644 --- a/src/stream_output/sdp.c +++ b/src/stream_output/sdp.c @@ -93,6 +93,11 @@ static bool IsSDPString (const char *str) static void vsdp_AddAttribute(struct vlc_memstream *restrict stream, const char *name, const char *fmt, va_list ap) { + if (fmt == NULL) + { + vlc_memstream_printf(stream, "a=%s\r\n", name); + return; + } vlc_memstream_printf(stream, "a=%s:", name); vlc_memstream_vprintf(stream, fmt, ap); vlc_memstream_puts(stream, "\r\n"); _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
