From 61386fa275f98f91a9aa6ff5b39f985b675f3d7f Mon Sep 17 00:00:00 2001 From: van Hauser Date: Wed, 10 Dec 2014 10:01:24 +0100 Subject: [PATCH] http-form-fix for OSX and *BSD --- CHANGES | 1 + hydra-mod.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES b/CHANGES index bd1d3bb..06cd49a 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,7 @@ Changelog for hydra Release 8.2-pre * Added xhydra gtk patche by Petar Kaleychev to support modules that do not use usernames * Better library finding in ./configure for SVN + support for Darwin Homebrew +* Fixed http-form module crash that only occurs on *BSD/OSX systems. Thanks to zdk for reporting! * ... your patch? diff --git a/hydra-mod.c b/hydra-mod.c index 44eba85..8e016e9 100644 --- a/hydra-mod.c +++ b/hydra-mod.c @@ -974,8 +974,8 @@ int make_to_lower(char *buf) { char *hydra_strrep(char *string, char *oldpiece, char *newpiece) { int str_index, newstr_index, oldpiece_index, end, new_len, old_len, cpy_len; - char *c, oldstring[1024]; - static char newstring[1024]; + char *c, oldstring[1024], newstring[1024]; + static char finalstring[1024]; 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))) @@ -1011,7 +1011,8 @@ char *hydra_strrep(char *string, char *oldpiece, char *newpiece) { strcpy(newstring + newstr_index, oldstring + str_index); strcpy(oldstring, newstring); // } - return newstring; + strcpy(finalstring, newstring); + return finalstring; } unsigned char hydra_conv64(unsigned char in) {