[FFmpeg-cvslog] http: never send 'Cookie: (null)' to the server

wm4 git at videolan.org
Fri Mar 21 20:44:30 CET 2014


ffmpeg | branch: master | wm4 <nfxjfg at googlemail.com> | Fri Mar 21 18:51:30 2014 +0100| [76c8fbc5f22c4a93c08030b10e5dbbd4e0c4dd68] | committer: Michael Niedermayer

http: never send 'Cookie: (null)' to the server

If a domain has some cookies set, but matching the cookie fails due to
the port being different, get_cookies() succeeds, but sets cookies to
NULL. The caller of get_cookies() didn't check for the NULL value.

This also avoids passing NULL to libc string functions, which is
undefined behavior

Fixes Ticket2180

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

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

 libavformat/http.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/http.c b/libavformat/http.c
index 5e1c9ab..aefc9fa 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -746,7 +746,7 @@ static int http_connect(URLContext *h, const char *path, const char *local_path,
                            "Content-Type: %s\r\n", s->content_type);
     if (!has_header(s->headers, "\r\nCookie: ") && s->cookies) {
         char *cookies = NULL;
-        if (!get_cookies(s, &cookies, path, hoststr)) {
+        if (!get_cookies(s, &cookies, path, hoststr) && cookies) {
             len += av_strlcatf(headers + len, sizeof(headers) - len,
                                "Cookie: %s\r\n", cookies);
             av_free(cookies);



More information about the ffmpeg-cvslog mailing list