[vlc-commits] https: NULL deref

Rémi Denis-Courmont git at videolan.org
Thu Dec 31 14:46:15 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Dec 31 15:31:52 2015 +0200| [5adb1307d72331e4886cf89e0a033383bb48d8d6] | committer: Rémi Denis-Courmont

https: NULL deref

(in currently unused code)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5adb1307d72331e4886cf89e0a033383bb48d8d6
---

 modules/access/http/message.c      |    4 +++-
 modules/access/http/message_test.c |    1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/access/http/message.c b/modules/access/http/message.c
index 17113ac..592ea90 100644
--- a/modules/access/http/message.c
+++ b/modules/access/http/message.c
@@ -783,8 +783,10 @@ time_t vlc_http_msg_get_mtime(const struct vlc_http_msg *m)
 unsigned vlc_http_msg_get_retry_after(const struct vlc_http_msg *m)
 {
     const char *str = vlc_http_msg_get_header(m, "Retry-After");
-    char *end;
+    if (str == NULL)
+        return 0;
 
+    char *end;
     unsigned long delay = strtoul(str, &end, 10);
     if (end != str && *end == '\0')
         return delay;
diff --git a/modules/access/http/message_test.c b/modules/access/http/message_test.c
index de9d5e9..5e449e1 100644
--- a/modules/access/http/message_test.c
+++ b/modules/access/http/message_test.c
@@ -150,6 +150,7 @@ static time_t parse_date(const char *str)
     t1 = vlc_http_msg_get_atime(m);
     assert(vlc_http_msg_add_header(m, "Last-Modified", "%s", str) == 0);
     t2 = vlc_http_msg_get_mtime(m);
+    assert(vlc_http_msg_get_retry_after(m) == 0);
     assert(vlc_http_msg_add_header(m, "Retry-After", "%s", str) == 0);
     vlc_http_msg_get_retry_after(m);
     vlc_http_msg_destroy(m);



More information about the vlc-commits mailing list