Used snprintf() for concatenation

This commit is contained in:
goba62000374 2017-06-12 11:00:48 +01:00
parent 902d5e4698
commit 90a60119df

View File

@ -1535,15 +1535,12 @@ void handle_connection (int fd)
if (connptr->upstream_proxy != NULL) { if (connptr->upstream_proxy != NULL) {
if (connptr->upstream_proxy->user) if (connptr->upstream_proxy->user)
{ {
char proxy_auth[200] = ""; char plain[256];
char src[256]; char encoded[256];
char dst2[512]; char proxy_auth[256];
strcpy(src, connptr->upstream_proxy->user); snprintf (plain, 256, "%s:%s", connptr->upstream_proxy->user, connptr->upstream_proxy->pass);
strcat(src, ":"); encode_base_64(plain, encoded, 256);
strcat(src, connptr->upstream_proxy->pass); snprintf (proxy_auth, 256, "Basic %s", encoded);
encode_base_64(src, dst2, 512);
strcat(proxy_auth, "Basic ");
strcat(proxy_auth, dst2);
hashmap_insert (hashofheaders, hashmap_insert (hashofheaders,
"Proxy-Authorization", "Proxy-Authorization",