Loading src/event-timeout.c +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ timeouts_create(uint64_t timestamp) struct Timeouts *timeouts; timeouts = (struct Timeouts *)malloc(sizeof(*timeouts)); if (timeouts == NULL) exit(1); memset(timeouts, 0, sizeof(*timeouts)); timeouts->mask = sizeof(timeouts->slots)/sizeof(timeouts->slots[0]) - 1; Loading src/main-dedup.c +2 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ dedup_create() struct DedupTable *result; result = (struct DedupTable *)malloc(sizeof(*result)); if (result == NULL) exit(1); memset(result, 0, sizeof(*result)); return result; Loading src/main.c +4 −1 Original line number Diff line number Diff line Loading @@ -504,7 +504,7 @@ receive_thread(void *v) while (!control_c_pressed_again) pixie_usleep(10000); parms->done_receiving = 1; return; goto end; } /* Loading Loading @@ -772,6 +772,7 @@ receive_thread(void *v) /* * cleanup */ end: if (tcpcon) tcpcon_destroy_table(tcpcon); dedup_destroy(dedup); Loading Loading @@ -959,6 +960,8 @@ main_scan(struct Masscan *masscan) unsigned i; for (i=0; i<BUFFER_COUNT-1; i++) { struct PacketBuffer *p = (struct PacketBuffer *)malloc(sizeof(*p)); if (p == NULL) exit(1); err = rte_ring_sp_enqueue(parms->packet_buffers, p); if (err) { /* I dunno why but I can't queue all 256 packets, just 255 */ Loading src/out-binary.c +25 −5 Original line number Diff line number Diff line Loading @@ -8,13 +8,18 @@ static void binary_out_open(struct Output *out, FILE *fp) { char firstrecord[2+'a']; size_t bytes_written; UNUSEDPARM(out); memset(firstrecord, 0, 2+'a'); sprintf_s(firstrecord, 2+'a', "masscan/1.1.01"); fwrite( firstrecord, 1, 2+'a', fp); bytes_written = fwrite(firstrecord, 1, 2+'a', fp); if (bytes_written != 2+'a') { perror("output"); exit(1); } } Loading @@ -24,12 +29,17 @@ static void binary_out_close(struct Output *out, FILE *fp) { char firstrecord[2+'a']; size_t bytes_written; UNUSEDPARM(out); memset(firstrecord, 0, 2+'a'); sprintf_s(firstrecord, 2+'a', "masscan/1.1"); fwrite( firstrecord, 1, 2+'a', fp); bytes_written = fwrite(firstrecord, 1, 2+'a', fp); if (bytes_written != 2+'a') { perror("output"); exit(1); } } /**************************************************************************** Loading @@ -38,6 +48,7 @@ static void binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigned port, unsigned reason, unsigned ttl) { unsigned char foo[256]; size_t bytes_written; UNUSEDPARM(out); Loading Loading @@ -75,7 +86,11 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne fwrite(&foo, 1, 14, fp); bytes_written = fwrite(&foo, 1, 14, fp); if (bytes_written != 14) { perror("output"); exit(1); } } Loading @@ -87,6 +102,7 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, { unsigned char foo[32768]; unsigned i; size_t bytes_written; UNUSEDPARM(out); Loading Loading @@ -128,7 +144,11 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, memcpy(foo+i+13, px, length); fwrite(&foo, 1, length+i+13, fp); bytes_written = fwrite(&foo, 1, length+i+13, fp); if (bytes_written != length+i+13) { perror("output"); exit(1); } } Loading src/proto-arp.c +2 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,8 @@ void handle_arp(struct Output *out, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) handle_arp(struct Output *out, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) { unsigned ip_them; Loading Loading
src/event-timeout.c +2 −0 Original line number Diff line number Diff line Loading @@ -60,6 +60,8 @@ timeouts_create(uint64_t timestamp) struct Timeouts *timeouts; timeouts = (struct Timeouts *)malloc(sizeof(*timeouts)); if (timeouts == NULL) exit(1); memset(timeouts, 0, sizeof(*timeouts)); timeouts->mask = sizeof(timeouts->slots)/sizeof(timeouts->slots[0]) - 1; Loading
src/main-dedup.c +2 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,8 @@ dedup_create() struct DedupTable *result; result = (struct DedupTable *)malloc(sizeof(*result)); if (result == NULL) exit(1); memset(result, 0, sizeof(*result)); return result; Loading
src/main.c +4 −1 Original line number Diff line number Diff line Loading @@ -504,7 +504,7 @@ receive_thread(void *v) while (!control_c_pressed_again) pixie_usleep(10000); parms->done_receiving = 1; return; goto end; } /* Loading Loading @@ -772,6 +772,7 @@ receive_thread(void *v) /* * cleanup */ end: if (tcpcon) tcpcon_destroy_table(tcpcon); dedup_destroy(dedup); Loading Loading @@ -959,6 +960,8 @@ main_scan(struct Masscan *masscan) unsigned i; for (i=0; i<BUFFER_COUNT-1; i++) { struct PacketBuffer *p = (struct PacketBuffer *)malloc(sizeof(*p)); if (p == NULL) exit(1); err = rte_ring_sp_enqueue(parms->packet_buffers, p); if (err) { /* I dunno why but I can't queue all 256 packets, just 255 */ Loading
src/out-binary.c +25 −5 Original line number Diff line number Diff line Loading @@ -8,13 +8,18 @@ static void binary_out_open(struct Output *out, FILE *fp) { char firstrecord[2+'a']; size_t bytes_written; UNUSEDPARM(out); memset(firstrecord, 0, 2+'a'); sprintf_s(firstrecord, 2+'a', "masscan/1.1.01"); fwrite( firstrecord, 1, 2+'a', fp); bytes_written = fwrite(firstrecord, 1, 2+'a', fp); if (bytes_written != 2+'a') { perror("output"); exit(1); } } Loading @@ -24,12 +29,17 @@ static void binary_out_close(struct Output *out, FILE *fp) { char firstrecord[2+'a']; size_t bytes_written; UNUSEDPARM(out); memset(firstrecord, 0, 2+'a'); sprintf_s(firstrecord, 2+'a', "masscan/1.1"); fwrite( firstrecord, 1, 2+'a', fp); bytes_written = fwrite(firstrecord, 1, 2+'a', fp); if (bytes_written != 2+'a') { perror("output"); exit(1); } } /**************************************************************************** Loading @@ -38,6 +48,7 @@ static void binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigned port, unsigned reason, unsigned ttl) { unsigned char foo[256]; size_t bytes_written; UNUSEDPARM(out); Loading Loading @@ -75,7 +86,11 @@ binary_out_status(struct Output *out, FILE *fp, int status, unsigned ip, unsigne fwrite(&foo, 1, 14, fp); bytes_written = fwrite(&foo, 1, 14, fp); if (bytes_written != 14) { perror("output"); exit(1); } } Loading @@ -87,6 +102,7 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, { unsigned char foo[32768]; unsigned i; size_t bytes_written; UNUSEDPARM(out); Loading Loading @@ -128,7 +144,11 @@ binary_out_banner(struct Output *out, FILE *fp, unsigned ip, unsigned ip_proto, memcpy(foo+i+13, px, length); fwrite(&foo, 1, length+i+13, fp); bytes_written = fwrite(&foo, 1, length+i+13, fp); if (bytes_written != length+i+13) { perror("output"); exit(1); } } Loading
src/proto-arp.c +2 −1 Original line number Diff line number Diff line Loading @@ -8,7 +8,8 @@ void handle_arp(struct Output *out, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) handle_arp(struct Output *out, const unsigned char *px, unsigned length, struct PreprocessedInfo *parsed) { unsigned ip_them; Loading