From c760e7e5c5bbe75957e4a4003a14a1bee3a9c86c Mon Sep 17 00:00:00 2001 From: Diadlo Date: Mon, 17 Apr 2017 22:41:12 +0300 Subject: [PATCH] Fix size of pointer instead of size of data --- hydra-ncp.c | 2 +- hydra.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hydra-ncp.c b/hydra-ncp.c index 7573e35..f4bc62f 100644 --- a/hydra-ncp.c +++ b/hydra-ncp.c @@ -65,7 +65,7 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F } memset(context, 0, sizeof(context)); strncpy(context, login, strlen(login)); - strncpy(context + strlen(login), miscptr, sizeof(miscptr) + 1); + strncpy(context + strlen(login), miscptr, sizeof(char) + 1); login = context; } } diff --git a/hydra.c b/hydra.c index a338026..098dfeb 100644 --- a/hydra.c +++ b/hydra.c @@ -3512,7 +3512,7 @@ int main(int argc, char *argv[]) { exit(-1); } // if (countinfile > 60) fprintf(stderr, "[WARNING] the -M option is not working correctly at the moment for target lists > 60!\n"); - hydra_targets = malloc(sizeof(hydra_targets) * (countservers + 2) + 8); + hydra_targets = malloc(sizeof(hydra_target*) * (countservers + 2) + 8); if (hydra_targets == NULL) bail("Could not allocate enough memory for target data"); sizeinfile = size_of_data; @@ -3600,7 +3600,7 @@ int main(int argc, char *argv[]) { four_from = (addr4 & l); l = 1 << (32 - k); hydra_brains.targets = countservers = l; - hydra_targets = malloc(sizeof(hydra_targets) * (l + 2) + 8); + hydra_targets = malloc(sizeof(hydra_target*) * (l + 2) + 8); if (hydra_targets == NULL) bail("Could not allocate enough memory for target data"); i = 0; @@ -3864,7 +3864,7 @@ int main(int argc, char *argv[]) { #endif if (hydra_options.restore == 0) { - hydra_heads = malloc(sizeof(hydra_heads) * hydra_options.max_use); + hydra_heads = malloc(sizeof(hydra_head*) * hydra_options.max_use); target_no = 0; for (i = 0; i < hydra_options.max_use; i++) { hydra_heads[i] = malloc(sizeof(hydra_head));