From 429c525aa1746362d867a72305d356c9998a6eff Mon Sep 17 00:00:00 2001 From: George Wang Date: Mon, 19 Dec 2016 14:47:42 -0500 Subject: [PATCH] [BUGFIX] use the first unknown key/value pair as the cookie name/value, also fixed a memory leak. --- src/cookie.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cookie.c b/src/cookie.c index 54355c1..e6f3402 100644 --- a/src/cookie.c +++ b/src/cookie.c @@ -293,8 +293,10 @@ __parse_input(COOKIE this, char *str, char *host) } else if (!strncasecmp(key, "secure", 6)) { this->secure = TRUE; } else { - this->name = strdup(key); - this->value = strdup(val); + if (!this->name) + this->name = strdup(key); + if (!this->value) + this->value = strdup(val); } } if (this->expires < 1000) {