From 68868bbb3737d26c197f39edafc5d526334426b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Thu, 13 Feb 2020 16:11:51 +0100 Subject: [PATCH] * src/http.c (print_response_line): Remove use of alloca --- src/http.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/http.c b/src/http.c index bf92e69d..4d29ead1 100644 --- a/src/http.c +++ b/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