43 lines
1.2 KiB
Diff
43 lines
1.2 KiB
Diff
|
From d73dc8d3e70bde0ef999ecf7bcd5585b9892371c Mon Sep 17 00:00:00 2001
|
||
|
From: Michael Wallner <mike@php.net>
|
||
|
Date: Mon, 25 Feb 2019 19:05:02 +0100
|
||
|
Subject: [PATCH] cookies: fix NULL dereference if flushing cookies with no
|
||
|
CookieInfo set
|
||
|
|
||
|
Regression brought by a52e46f3900fb0 (shipped in 7.63.0)
|
||
|
|
||
|
Closes #3613
|
||
|
|
||
|
Upstream-commit: 8eddb8f4259193633cfc95a42603958a89b31de5
|
||
|
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
||
|
---
|
||
|
lib/cookie.c | 5 +++--
|
||
|
1 file changed, 3 insertions(+), 2 deletions(-)
|
||
|
|
||
|
diff --git a/lib/cookie.c b/lib/cookie.c
|
||
|
index 4fb992a..d535170 100644
|
||
|
--- a/lib/cookie.c
|
||
|
+++ b/lib/cookie.c
|
||
|
@@ -1504,7 +1504,8 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
|
||
|
struct Cookie **array;
|
||
|
|
||
|
/* at first, remove expired cookies */
|
||
|
- remove_expired(c);
|
||
|
+ if(c)
|
||
|
+ remove_expired(c);
|
||
|
|
||
|
if(!strcmp("-", dumphere)) {
|
||
|
/* use stdout */
|
||
|
@@ -1523,7 +1524,7 @@ static int cookie_output(struct CookieInfo *c, const char *dumphere)
|
||
|
"# This file was generated by libcurl! Edit at your own risk.\n\n",
|
||
|
out);
|
||
|
|
||
|
- if(c->numcookies) {
|
||
|
+ if(c && c->numcookies) {
|
||
|
array = malloc(sizeof(struct Cookie *) * c->numcookies);
|
||
|
if(!array) {
|
||
|
if(!use_stdout)
|
||
|
--
|
||
|
2.17.2
|
||
|
|