[FFmpeg-devel] [PATCH v3] Parse cookies more correctly
Michael Niedermayer
michaelni at gmx.at
Thu Feb 13 15:24:25 CET 2014
On Wed, Feb 12, 2014 at 09:07:42PM -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 | 18 +++++++++++++++---
> 1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/libavformat/http.c b/libavformat/http.c
> index 69c4d6d..3ea2e55 100644
> --- a/libavformat/http.c
> +++ b/libavformat/http.c
> @@ -484,8 +484,19 @@ 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))) {
> + /* skip trailing spaces */
> + while (0x20 == cookie[strlen(cookie) - 1]) {
> + cookie[strlen(cookie) - 1] = 0;
> + }
probably redundant
unless i miss something ?
> +
> + while ((param = av_strtok(cookie, ";", &next_param))) {
> cookie = NULL;
> + /* skip leading spaces */
> + param += strspn(param, " ");
> + /* skip trailing spaces */
> + while (0x20 == param[strlen(param) - 1]) {
> + param[strlen(param) - 1] = 0;
> + }
indention is wrong
also this can read and write out of array
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
No human being will ever know the Truth, for even if they happen to say it
by chance, they would not even known they had done so. -- Xenophanes
-------------- 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/20140213/2f634982/attachment.asc>
More information about the ffmpeg-devel
mailing list