This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/9.1 in repository ffmpeg.
commit c72b364ba7dfec622cd0a9bda4744363a6ead34a Author: Michael Niedermayer <[email protected]> AuthorDate: Sat Nov 7 00:22:54 2026 +0100 Commit: Michael Niedermayer <[email protected]> CommitDate: Thu Nov 19 14:56:30 2026 +0100 avformat/httpcookie: ignore cookies containing control characters As specified by draft-ietf-httpbis-rfc6265bis section 5.6. A CR in a cookie given through the cookies option ended up in the request header. Fixes: control characters in the Cookie request header (cherry picked from commit 1d80ce51e3b9685ae08a6cb5ffce9dc162b7d7f4) Signed-off-by: Michael Niedermayer <[email protected]> --- libavformat/httpcookie.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/libavformat/httpcookie.c b/libavformat/httpcookie.c index e1ab2a9681..aa4be75273 100644 --- a/libavformat/httpcookie.c +++ b/libavformat/httpcookie.c @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <stdint.h> #include <string.h> #include "libavutil/avstring.h" @@ -64,6 +65,14 @@ static char *trim(char *str) return str; } +static int has_control_char(const char *str) +{ + for (; *str; str++) + if (((uint8_t)*str < 0x20 && *str != '\t') || *str == 0x7f) + return 1; + return 0; +} + int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDictionary **attributes) { char *param, *next_param, *cstr, *eql; @@ -73,8 +82,14 @@ int ff_http_parse_set_cookie(const char *set_cookie, AVDictionary **cookie, AVDi if (!(cstr = av_strdup(set_cookie))) return AVERROR(ENOMEM); + // a line with control characters other than HTAB holds no cookie (RFC 6265bis 5.6) + param = trim(cstr); + if (has_control_char(param)) { + av_free(cstr); + return AVERROR_INVALIDDATA; + } + // the name and value of the cookie come before the first ';' - param = trim(cstr); next_param = strchr(param, ';'); if (next_param) *next_param++ = '\0'; -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
