mirror of
https://github.com/mirror/wget.git
synced 2025-01-30 22:30:13 +08:00
* src/http.c (print_response_line): Remove use of alloca
This commit is contained in:
parent
a3f2ba708d
commit
68868bbb37
16
src/http.c
16
src/http.c
@ -868,10 +868,22 @@ resp_free (struct response **resp_ref)
|
||||
static void
|
||||
print_response_line (const char *prefix, const char *b, const char *e)
|
||||
{
|
||||
char *copy;
|
||||
BOUNDED_TO_ALLOCA(b, e, copy);
|
||||
char buf[1024], *copy;
|
||||
size_t len = e - b;
|
||||
|
||||
if (len < buf)
|
||||
copy = buf;
|
||||
else
|
||||
copy = xmalloc(len + 1);
|
||||
|
||||
memcpy(copy, b, len);
|
||||
copy[len] = 0;
|
||||
|
||||
logprintf (LOG_ALWAYS, "%s%s\n", prefix,
|
||||
quotearg_style (escape_quoting_style, copy));
|
||||
|
||||
if (copy != buf)
|
||||
xfree (copy);
|
||||
}
|
||||
|
||||
/* Print the server response, line by line, omitting the trailing CRLF
|
||||
|
Loading…
Reference in New Issue
Block a user