]> git.ipfire.org Git - thirdparty/curl.git/commit
cookies: Fix potential NULL pointer deref with PSL
authorDaniel Gustafsson <daniel@yesql.se>
Fri, 12 Mar 2021 01:34:03 +0000 (02:34 +0100)
committerDaniel Gustafsson <daniel@yesql.se>
Fri, 12 Mar 2021 01:34:03 +0000 (02:34 +0100)
commitf7aeff58a369d3cd2caac4f3becd7c683ba900c7
tree9df1c29e58acd3603ae2ef16f42cb49d64207b1d
parentb3ace846425052b10126000289295e60763c520e
cookies: Fix potential NULL pointer deref with PSL

Curl_cookie_init can be called with data being NULL, and this can in turn
be passed to Curl_cookie_add, meaning that both functions must be careful
to only use data where it's checked for being a NULL pointer.  The libpsl
support code does however dereference data without checking, so if we are
indeed having an unset data pointer we cannot PSL check the cookiedomain.

This is currently not a reachable dereference, as the only caller with a
NULL data isn't passing a file to initialize cookies from, but since the
API has this contract let's ensure we hold it.

Closes #6731
Reviewed-by: Daniel Stenberg <daniel@haxx.se>
lib/cookie.c