mirror of
https://github.com/mirror/wget.git
synced 2025-01-19 16:50:08 +08:00
* src/cookies.c (parse_set_cookie): Remove use of alloca
This commit is contained in:
parent
92c0d39894
commit
e5cf56d7fa
@ -423,11 +423,14 @@ parse_set_cookie (const char *set_cookie, bool silent)
|
|||||||
else if (TOKEN_IS (name, "max-age"))
|
else if (TOKEN_IS (name, "max-age"))
|
||||||
{
|
{
|
||||||
double maxage = -1;
|
double maxage = -1;
|
||||||
char *value_copy;
|
char value_copy[32];
|
||||||
|
size_t value_len = value.e - value.b;
|
||||||
|
|
||||||
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;
|
||||||
|
|
||||||
sscanf (value_copy, "%lf", &maxage);
|
sscanf (value_copy, "%lf", &maxage);
|
||||||
if (maxage == -1)
|
if (maxage == -1)
|
||||||
|
Loading…
Reference in New Issue
Block a user