summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/cookie.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/cookie.c b/lib/cookie.c
index 09fd092ac..c7229c001 100644
--- a/lib/cookie.c
+++ b/lib/cookie.c
@@ -951,8 +951,12 @@ Curl_cookie_add(struct Curl_easy *data,
remove_expired(c);
#ifdef USE_LIBPSL
- /* Check if the domain is a Public Suffix and if yes, ignore the cookie. */
- if(domain && co->domain && !isip(co->domain)) {
+ /*
+ * Check if the domain is a Public Suffix and if yes, ignore the cookie. We
+ * must also check that the data handle isn't NULL since the psl code will
+ * dereference it.
+ */
+ if(data && (domain && co->domain && !isip(co->domain))) {
const psl_ctx_t *psl = Curl_psl_use(data);
int acceptable;