diff --git a/src/html-parse.c b/src/html-parse.c
index 30c8ae8e..63677324 100644
--- a/src/html-parse.c
+++ b/src/html-parse.c
@@ -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