This commit is contained in:
van Hauser 2017-04-18 09:42:09 +02:00
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: * 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 -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 * ./configure now honors the CC enviroment variable if present
* fixed a bug in the NCP module
* Favor strrchr() over rindex() * Favor strrchr() over rindex()
* Added refactoring patch by diadlo
* Updated man page with missing command line options * 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; return 4;
} }
memset(context, 0, sizeof(context)); memset(context, 0, sizeof(context));
strncpy(context, login, strlen(login)); strncpy(context, login, sizeof(context) - 2);
strncpy(context + strlen(login), miscptr, sizeof(char) + 1); context[sizeof(context) - 2] = 0;
strncpy(context + strlen(login), miscptr, sizeof(context) - strlen(login) - 1);
context[sizeof(context) - 1] = 0;
login = context; login = context;
} }
} }

11
hydra.c
View file

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