From e759b3768c3087303caffed0bb47c6a416d1bc78 Mon Sep 17 00:00:00 2001 From: David Maciejak Date: Sun, 3 Mar 2019 23:24:09 +0800 Subject: [PATCH] Fix compilation warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit hydra-redis.c: In function ‘start_redis’: hydra-redis.c:18:51: warning: ‘%.250s’ directive writing up to 250 bytes into a region of size between 243 and 493 [-Wformat-overflow=] sprintf(buffer, "*2\r\n$4\r\nAUTH\r\n$%.250s\r\n%.250s\r\n", pass_num, pass); ^~~~~~ In file included from /usr/include/stdio.h:862:0, from hydra.h:3, from hydra-mod.h:4, from hydra-redis.c:1: /usr/include/x86_64-linux-gnu/bits/stdio2.h:33:10: note: ‘__builtin___sprintf_chk’ output between 20 and 520 bytes into a destination of size 510 return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __bos (__s), __fmt, __va_arg_pack ()); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- hydra-redis.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hydra-redis.c b/hydra-redis.c index 76a6afb..c010577 100644 --- a/hydra-redis.c +++ b/hydra-redis.c @@ -15,7 +15,7 @@ int32_t start_redis(int32_t s, char *ip, int32_t port, unsigned char options, ch snprintf(pass_num, 50, "%d", pass_len); memset(buffer, 0, sizeof(buffer)); - sprintf(buffer, "*2\r\n$4\r\nAUTH\r\n$%.250s\r\n%.250s\r\n", pass_num, pass); + sprintf(buffer, "*2\r\n$4\r\nAUTH\r\n$%.50s\r\n%.250s\r\n", pass_num, pass); if (debug) hydra_report(stderr, "[DEBUG] Auth:\n %s\n", buffer);