From 66562bd73cbb904dc929575a32cbd71542f03a08 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sat, 10 Jun 2017 23:54:32 +0300 Subject: [PATCH] Move null pointer check before pointer using --- hydra-mod.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hydra-mod.c b/hydra-mod.c index b675377..fd16e54 100644 --- a/hydra-mod.c +++ b/hydra-mod.c @@ -1043,15 +1043,15 @@ char *hydra_strrep(char *string, char *oldpiece, char *newpiece) { char *c, oldstring[6096], newstring[6096]; //updated due to issue 192 on github. static char finalstring[6096]; - if(strlen(string) > 6000) { - hydra_report(stderr, "[ERROR] Supplied URL or POST data too large. Max limit is 6000 characters.\n"); - exit(-1); - } - if (string == NULL || oldpiece == NULL || newpiece == NULL || strlen(string) >= sizeof(oldstring) - 1 || (strlen(string) + strlen(newpiece) - strlen(oldpiece) >= sizeof(newstring) - 1 && strlen(string) > strlen(oldpiece))) return NULL; + if (strlen(string) > 6000) { + hydra_report(stderr, "[ERROR] Supplied URL or POST data too large. Max limit is 6000 characters.\n"); + exit(-1); + } + strcpy(newstring, string); strcpy(oldstring, string);