From 90a60119dfeb0960c2b61ac480d0ef08840825a7 Mon Sep 17 00:00:00 2001 From: goba62000374 Date: Mon, 12 Jun 2017 11:00:48 +0100 Subject: [PATCH] Used snprintf() for concatenation --- src/reqs.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/reqs.c b/src/reqs.c index 26c67ef..5e07b6e 100644 --- a/src/reqs.c +++ b/src/reqs.c @@ -1535,15 +1535,12 @@ void handle_connection (int fd) if (connptr->upstream_proxy != NULL) { if (connptr->upstream_proxy->user) { - char proxy_auth[200] = ""; - char src[256]; - char dst2[512]; - strcpy(src, connptr->upstream_proxy->user); - strcat(src, ":"); - strcat(src, connptr->upstream_proxy->pass); - encode_base_64(src, dst2, 512); - strcat(proxy_auth, "Basic "); - strcat(proxy_auth, dst2); + char plain[256]; + char encoded[256]; + char proxy_auth[256]; + snprintf (plain, 256, "%s:%s", connptr->upstream_proxy->user, connptr->upstream_proxy->pass); + encode_base_64(plain, encoded, 256); + snprintf (proxy_auth, 256, "Basic %s", encoded); hashmap_insert (hashofheaders, "Proxy-Authorization",