* src/html-parse.c (name_allowed): Remove use of alloca

This commit is contained in:
Tim Rühsen 2020-02-13 17:01:29 +01:00
parent 6cc9acfd61
commit 5505aced03

View File

@ -777,11 +777,27 @@ find_comment_end (const char *beg, const char *end)
static bool
name_allowed (const struct hash_table *ht, const char *b, const char *e)
{
char *copy;
char buf[256], *copy;
size_t len = e - b;
bool ret;
if (!ht)
return true;
BOUNDED_TO_ALLOCA (b, e, copy);
return hash_table_get (ht, copy) != NULL;
if (len < sizeof (buf))
copy = buf;
else
copy = xmalloc (len + 1);
memcpy (copy, b, len);
copy[len] = 0;
ret = hash_table_get (ht, copy) != NULL;
if (copy != buf)
xfree (copy);
return ret;
}
/* Advance P (a char pointer), with the explicit intent of being able