mirror of
https://github.com/vanhauser-thc/thc-hydra.git
synced 2025-08-19 21:03:52 -07:00
Move null pointer check before pointer using
This commit is contained in:
parent
63ebf3ec25
commit
66562bd73c
1 changed files with 5 additions and 5 deletions
|
@ -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.
|
char *c, oldstring[6096], newstring[6096]; //updated due to issue 192 on github.
|
||||||
static char finalstring[6096];
|
static char finalstring[6096];
|
||||||
|
|
||||||
|
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) {
|
if (strlen(string) > 6000) {
|
||||||
hydra_report(stderr, "[ERROR] Supplied URL or POST data too large. Max limit is 6000 characters.\n");
|
hydra_report(stderr, "[ERROR] Supplied URL or POST data too large. Max limit is 6000 characters.\n");
|
||||||
exit(-1);
|
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;
|
|
||||||
|
|
||||||
strcpy(newstring, string);
|
strcpy(newstring, string);
|
||||||
strcpy(oldstring, string);
|
strcpy(oldstring, string);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue