mirror of
https://github.com/mirror/wget.git
synced 2025-01-03 00:40:28 +08:00
* src/html-parse.c (name_allowed): Remove use of alloca
This commit is contained in:
parent
6cc9acfd61
commit
5505aced03
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user