From a3f2ba708d1e6fe65db59314e082e91df379e694 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20R=C3=BChsen?= Date: Thu, 13 Feb 2020 16:11:23 +0100 Subject: [PATCH] * src/http.c (request_set_user_header): Remove use of alloca --- src/http.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/http.c b/src/http.c index 081ad566..bf92e69d 100644 --- a/src/http.c +++ b/src/http.c @@ -280,15 +280,18 @@ request_set_header (struct request *req, const char *name, const char *value, static void request_set_user_header (struct request *req, const char *header) { - char *name; - const char *p = strchr (header, ':'); - if (!p) + const char *name, *p; + + if (!(p = strchr (header, ':'))) return; - BOUNDED_TO_ALLOCA (header, p, name); + + name = xstrndup(header, p - header); + ++p; while (c_isspace (*p)) ++p; - request_set_header (req, xstrdup (name), (char *) p, rel_name); + + request_set_header (req, name, (char *) p, rel_name); } /* Remove the header with specified name from REQ. Returns true if