From edc01ed0492ebe4ab046b39381fb3a0d8c7f3db3 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Tue, 5 Mar 2019 12:45:41 +0800 Subject: [PATCH] Fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See below full log: hydra-http-proxy.c: In function ‘start_http_proxy’: hydra-http-proxy.c:26:26: warning: ‘%.200s’ directive writing up to 200 bytes into a region of size 24 [-Wformat-overflow=] sprintf(host, "Host: %.200s", ptr + 3); ^~~~~~ In file included from /usr/include/stdio.h:862:0, from hydra.h:3, from hydra-mod.h:4, from hydra-http-proxy.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 7 and 207 bytes into a destination of size 30 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- hydra-http-proxy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hydra-http-proxy.c b/hydra-http-proxy.c index cc9ad6b..cdeb714 100644 --- a/hydra-http-proxy.c +++ b/hydra-http-proxy.c @@ -8,7 +8,7 @@ char *http_proxy_buf = NULL; int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char options, char *miscptr, FILE * fp, char *hostname) { char *empty = ""; char *login, *pass, buffer[500], buffer2[500]; - char url[210], host[30]; + char url[210], host[60]; char *header = ""; /* XXX TODO */ char *ptr, *fooptr; @@ -23,7 +23,7 @@ int32_t start_http_proxy(int32_t s, char *ip, int32_t port, unsigned char option } else { sprintf(url, "%.200s", miscptr); ptr = strstr(miscptr, "://"); // :// check is in hydra.c - sprintf(host, "Host: %.200s", ptr + 3); + sprintf(host, "Host: %.50s", ptr + 3); if ((ptr = index(host, '/')) != NULL) *ptr = 0; if ((ptr = index(host + 6, ':')) != NULL && host[0] != '[')