mirror of
https://github.com/mirror/wget.git
synced 2025-03-27 12:30:19 +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
|
static void
|
||||||
print_response_line (const char *prefix, const char *b, const char *e)
|
print_response_line (const char *prefix, const char *b, const char *e)
|
||||||
{
|
{
|
||||||
char *copy;
|
char buf[1024], *copy;
|
||||||
BOUNDED_TO_ALLOCA(b, e, 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,
|
logprintf (LOG_ALWAYS, "%s%s\n", prefix,
|
||||||
quotearg_style (escape_quoting_style, copy));
|
quotearg_style (escape_quoting_style, copy));
|
||||||
|
|
||||||
|
if (copy != buf)
|
||||||
|
xfree (copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print the server response, line by line, omitting the trailing CRLF
|
/* Print the server response, line by line, omitting the trailing CRLF
|
||||||
|
Loading…
Reference in New Issue
Block a user