[SCM] libav/experimental: Reduce allocated length of the HTTP authentication request field buffer, as noticed by Stefano and Luca in the "[PATCH]RTSP Basic Authentication" mailinglist thread.

siretart at users.alioth.debian.org siretart at users.alioth.debian.org
Sun Jun 30 16:40:21 UTC 2013


The following commit has been merged in the experimental branch:
commit d176f9038711e497b32f1431e60e4e3da94179d1
Author: Ronald S. Bultje <rsbultje at gmail.com>
Date:   Tue Mar 3 13:26:17 2009 +0000

    Reduce allocated length of the HTTP authentication request field buffer, as
    noticed by Stefano and Luca in the "[PATCH]RTSP Basic Authentication"
    mailinglist thread.
    
    av_base64_encode() was recently changed. The previous implementation required
    12 extra bytes (ceil(len(src)/3.)*4+12), whereas the new one is guaranteed to
    fit in an exact buffer (ceil(len(src)/3.)*4), plus one extra byte for the
    trailing zero. This change fixes no bug, it just slightly decreases the
    amount of allocated memory.
    
    Originally committed as revision 17761 to svn://svn.ffmpeg.org/ffmpeg/trunk

diff --git a/libavformat/http.c b/libavformat/http.c
index 2e6a1db..039ef7b 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -212,7 +212,7 @@ static int http_connect(URLContext *h, const char *path, const char *hoststr,
     int post, err, ch;
     char line[1024], *q;
     char *auth_b64;
-    int auth_b64_len = strlen(auth)* 4 / 3 + 12;
+    int auth_b64_len = (strlen(auth) + 2) / 3 * 4 + 1;
     int64_t off = s->off;
 
 

-- 
Libav/FFmpeg packaging



More information about the pkg-multimedia-commits mailing list