Commit 10ae2f0c7c for ffmpeg
commit 10ae2f0c7c18ae09f765f106116ddeb0da76a845
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Nov 7 00:21:47 2026 +0100
avformat/httpcookie: split attributes at their first '=' and ignore unnamed ones
av_strtok() skipped leading '=', so "=domain=x" was taken as a Domain.
Fixes: cookie attributes without a name
diff --git a/libavformat/httpcookie.c b/libavformat/httpcookie.c
index f0d3f61bb9..369a367181 100644
--- a/libavformat/httpcookie.c
+++ b/libavformat/httpcookie.c
@@ -86,11 +86,13 @@ int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDi
ret = av_dict_set(cookie, trim(param), eql + 1, 0);
while (ret >= 0 && (param = av_strtok(next_param, ";", &saveptr))) {
- char *name, *value;
+ char *value = strchr(param, '=');
next_param = NULL;
- param += strspn(param, WHITESPACES);
- if ((name = av_strtok(param, "=", &value)))
- ret = av_dict_set(attributes, trim(name), value ? value : "", 0);
+ if (value)
+ *value++ = '\0';
+ param = trim(param);
+ if (*param)
+ ret = av_dict_set(attributes, param, value ? value : "", 0);
}
av_free(cstr);