This commit is contained in:
van Hauser 2017-04-18 09:42:09 +02:00
parent 7a4fa7b51e
commit d5827c4182
3 changed files with 10 additions and 9 deletions

View file

@ -5,7 +5,9 @@ Release 8.5-dev
* New command line option:
-b : format option for -o output file (json only so far, happy for patches supporting others :) ) - thanks to veggiespam for the patch
* ./configure now honors the CC enviroment variable if present
* fixed a bug in the NCP module
* Favor strrchr() over rindex()
* Added refactoring patch by diadlo
* Updated man page with missing command line options

View file

@ -64,8 +64,10 @@ int start_ncp(int s, char *ip, int port, unsigned char options, char *miscptr, F
return 4;
}
memset(context, 0, sizeof(context));
strncpy(context, login, strlen(login));
strncpy(context + strlen(login), miscptr, sizeof(char) + 1);
strncpy(context, login, sizeof(context) - 2);
context[sizeof(context) - 2] = 0;
strncpy(context + strlen(login), miscptr, sizeof(context) - strlen(login) - 1);
context[sizeof(context) - 1] = 0;
login = context;
}
}

11
hydra.c
View file

@ -663,9 +663,7 @@ void module_usage() {
#define STR_NULL(s) ((s) == NULL ? "(null)" : (s))
void hydra_debug(int force, char *string) {
int active = 0;
int inactive = 0;
int i;
int active = 0, inactive = 0, i;
if (!debug && !force)
return;
@ -700,9 +698,8 @@ void hydra_debug(int force, char *string) {
STR_NULL(target->pass_ptr));
}
if (hydra_heads == NULL) {
return
}
if (hydra_heads == NULL)
return;
for (i = 0; i < hydra_options.max_use; i++) {
if (hydra_heads[i]->active >= 0) {
@ -4174,7 +4171,7 @@ int main(int argc, char *argv[]) {
hydra_brains.sent, // tries
(long unsigned int) ((elapsed_status - starttime) / 3600), // hours
(long unsigned int) (((elapsed_status - starttime) % 3600) / 60), // minutes
(hydra_brains.todo_all + total_redo_count) - hydra_brains.sent, // left todo
(hydra_brains.todo_all + total_redo_count) - hydra_brains.sent != 0 ? (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent : 1, // left todo
(long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))
) / 3600, // hours
(((long unsigned int) (((double) (hydra_brains.todo_all + total_redo_count) - hydra_brains.sent) / ((double) hydra_brains.sent / (elapsed_status - starttime))