diff --git a/src/out-redis.c b/src/out-redis.c index f61f04cc..e259c366 100644 --- a/src/out-redis.c +++ b/src/out-redis.c @@ -149,9 +149,10 @@ clean_response_queue(struct Output *out, SOCKET fd) static void redis_out_open(struct Output *out, FILE *fp) { + /*FIXME: why did I write this code using ptrdiff_t? */ ptrdiff_t fd = (ptrdiff_t)fp; size_t count; - unsigned char line[1024]; + char line[1024]; UNUSEDPARM(out); if (out->redis.password != NULL) diff --git a/src/pixie-timer.c b/src/pixie-timer.c index 7d1fa5fb..d08afebd 100644 --- a/src/pixie-timer.c +++ b/src/pixie-timer.c @@ -254,6 +254,19 @@ pixie_nanotime(void) } #endif +/* + * Timing is incredibly importatn to masscan because we need to throttle + * how fast we spew packets. Every platofrm has slightly different timing + * even given standard APIs. We need to make sure we have an accurate + * timing function. + * + * This function tests betwe [0.9, 1.9] the expected results. I want something + * tight, like [0.99,1.01] (plus/minus 1%), but unfortunately automated + * testing platforms, like GitHub Actions, are overloaded, so when I wait + * for half a second, they might actually wait for 0.7 seconds, causing + * this test to fail. Thus, I have to greatly expand the range that passes + * this test. + */ int pixie_time_selftest(void) { static const uint64_t duration = 456789; diff --git a/src/proto-http.c b/src/proto-http.c index 4bb2a62c..0cae3fad 100644 --- a/src/proto-http.c +++ b/src/proto-http.c @@ -61,7 +61,8 @@ _http_append(unsigned char **inout_header, size_t length1, size_t length2, const } enum What {spaces, notspaces, end_of_line, end_of_field}; -size_t _skip(enum What what, const unsigned char *hdr, size_t offset, size_t header_length) +static size_t +_skip(enum What what, const unsigned char *hdr, size_t offset, size_t header_length) { switch (what) { case notspaces: @@ -221,7 +222,8 @@ http_change_requestline(unsigned char **hdr, size_t header_length, return header_length; } -size_t _field_length(const unsigned char *hdr, size_t offset, size_t hdr_length) +static size_t +_field_length(const unsigned char *hdr, size_t offset, size_t hdr_length) { size_t original_offset = offset; diff --git a/src/proto-mc.c b/src/proto-mc.c index f44ac153..f25ddecb 100644 --- a/src/proto-mc.c +++ b/src/proto-mc.c @@ -10,7 +10,8 @@ static unsigned char hand_shake_ptr[128]; -unsigned char* hand_shake(uint16_t port, const char* ip,size_t ip_len) +static unsigned char * +hand_shake(uint16_t port, const char* ip, size_t ip_len) { size_t tlen = 10+ip_len; unsigned char * ret = (unsigned char *)calloc(1,tlen); @@ -27,7 +28,8 @@ unsigned char* hand_shake(uint16_t port, const char* ip,size_t ip_len) return ret; } -void* memstr(void * mem, size_t len, char * str) +static void * +memstr(void * mem, size_t len, char * str) { size_t stlen = strlen(str); if(len < stlen) diff --git a/src/string_s.c b/src/string_s.c index c4b29105..10dfac0d 100644 --- a/src/string_s.c +++ b/src/string_s.c @@ -33,7 +33,7 @@ errno_t fopen_s(FILE **pFile, const char *filename, const char *mode) */ #ifdef __GNUC__ int -memcasecmp(const void *lhs, const void *rhs, int length) +memcasecmp(const void *lhs, const void *rhs, size_t length) { int i; for (i=0; i