* src/cookies.c (parse_set_cookie): Remove use of alloca

This commit is contained in:
Tim Rühsen 2020-02-14 12:03:50 +01:00
parent 92c0d39894
commit e5cf56d7fa

View File

@ -423,11 +423,14 @@ parse_set_cookie (const char *set_cookie, bool silent)
else if (TOKEN_IS (name, "max-age"))
{
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;
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);
if (maxage == -1)