[FFmpeg-devel] [PATCH v4] Parse cookies more correctly

Michael Niedermayer michaelni at gmx.at
Mon Feb 17 19:05:23 CET 2014


On Mon, Feb 17, 2014 at 01:35:33AM -0800, Scott Moak wrote:
> Cookies with an Expires directive do not get parsed (and ignored)
> correctly, so we need to fix that.
> 
> Signed-off-by: Scott Moak <scott.moak at mybrainoncode.com>
> ---
>  libavformat/http.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 69c4d6d..8462a3a 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -484,8 +484,16 @@ static int get_cookies(HTTPContext *s, char **cookies, const char *path,
>          char *param, *next_param, *cdomain = NULL, *cpath = NULL, *cvalue = NULL;
>          set_cookies = NULL;
>  
> -        while ((param = av_strtok(cookie, "; ", &next_param))) {
> +        while ((param = av_strtok(cookie, ";", &next_param))) {
>              cookie = NULL;
> +            /* skip leading spaces */
> +            param += strspn(param, " ");
> +            /* skip trailing spaces */

> +            if (param) {

param canot be NULL here, this is the wrong check
i assume you meant *param  ?


> +                while (0x20 == param[strlen(param) - 1]) {
> +                    param[strlen(param) - 1] = 0;
> +                }


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

If a bugfix only changes things apparently unrelated to the bug with no
further explanation, that is a good sign that the bugfix is wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140217/902594ac/attachment.asc>


More information about the ffmpeg-devel mailing list