mirror of
https://github.com/mirror/wget.git
synced 2025-02-08 02:30:17 +08:00
* src/http.c (metalink_from_http): Remove use of alloca
This commit is contained in:
parent
704208b766
commit
f1ce7f5bd6
10
src/http.c
10
src/http.c
@ -3039,14 +3039,22 @@ skip_content_type:
|
|||||||
/* The hash here is assumed to be base64. We need the hash in hex.
|
/* The hash here is assumed to be base64. We need the hash in hex.
|
||||||
Therefore we convert: base64 -> binary -> hex. */
|
Therefore we convert: base64 -> binary -> hex. */
|
||||||
const size_t dig_hash_str_len = strlen (dig_hash);
|
const size_t dig_hash_str_len = strlen (dig_hash);
|
||||||
char *bin_hash = alloca (dig_hash_str_len * 3 / 4 + 1);
|
char bin_hash[256];
|
||||||
ssize_t hash_bin_len;
|
ssize_t hash_bin_len;
|
||||||
|
|
||||||
|
// there is no hash with that size
|
||||||
|
if (dig_hash_str_len >= sizeof (bin_hash))
|
||||||
|
{
|
||||||
|
DEBUGP (("Hash too long, ignored.\n"));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
hash_bin_len = wget_base64_decode (dig_hash, bin_hash, dig_hash_str_len * 3 / 4 + 1);
|
hash_bin_len = wget_base64_decode (dig_hash, bin_hash, dig_hash_str_len * 3 / 4 + 1);
|
||||||
|
|
||||||
/* Detect malformed base64 input. */
|
/* Detect malformed base64 input. */
|
||||||
if (hash_bin_len < 0)
|
if (hash_bin_len < 0)
|
||||||
{
|
{
|
||||||
|
DEBUGP (("Malformed base64 input, ignored.\n"));
|
||||||
xfree (dig_type);
|
xfree (dig_type);
|
||||||
xfree (dig_hash);
|
xfree (dig_hash);
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user