mirror of
https://github.com/mirror/wget.git
synced 2025-03-13 11:20:19 +08:00
* src/cookies.c (parse_set_cookie): Remove use of alloca
This commit is contained in:
parent
8610b0b355
commit
78a848c69a
@ -395,12 +395,15 @@ parse_set_cookie (const char *set_cookie, bool silent)
|
|||||||
}
|
}
|
||||||
else if (TOKEN_IS (name, "expires"))
|
else if (TOKEN_IS (name, "expires"))
|
||||||
{
|
{
|
||||||
char *value_copy;
|
char value_copy[128];
|
||||||
|
size_t value_len = value.e - value.b;
|
||||||
time_t expires;
|
time_t expires;
|
||||||
|
|
||||||
if (!TOKEN_NON_EMPTY (value))
|
if (!TOKEN_NON_EMPTY (value) || value_len >= sizeof (value_copy))
|
||||||
goto error;
|
goto error;
|
||||||
BOUNDED_TO_ALLOCA (value.b, value.e, value_copy);
|
|
||||||
|
memcpy (value_copy, value.b, value_len);
|
||||||
|
value_copy[value_len] = 0;
|
||||||
|
|
||||||
/* Check if expiration spec is valid.
|
/* Check if expiration spec is valid.
|
||||||
If not, assume default (cookie doesn't expire, but valid only for
|
If not, assume default (cookie doesn't expire, but valid only for
|
||||||
|
Loading…
Reference in New Issue
Block a user