From ac46f3841f985579712a69207bee5f497a9476f7 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 5 Oct 2022 00:14:46 +0200 Subject: Fixed heap overflow on shutdown caused by missing remotes size/used reset. * introduced with 22a8d04c748ff3e04ca11c5c29b4433c7136f5f5 Signed-off-by: Toni Uhlig --- nDPIsrvd.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'nDPIsrvd.c') diff --git a/nDPIsrvd.c b/nDPIsrvd.c index bad7c5813..a8ee422b1 100644 --- a/nDPIsrvd.c +++ b/nDPIsrvd.c @@ -232,6 +232,7 @@ static int add_to_additional_write_buffers(struct remote_desc * const remote, "Buffer limit for", "for reached, remote too slow: %u lines", utarray_len(additional_write_buffers)); + logger_nDPIsrvd(remote, "%s", "You can try to increase buffer limits with `-C'."); return -1; } else @@ -719,6 +720,8 @@ static void free_remotes(int epollfd) } nDPIsrvd_free(remotes.desc); remotes.desc = NULL; + remotes.desc_used = 0; + remotes.desc_size = 0; } static int add_event(int epollfd, int events, int fd, void * ptr) @@ -849,7 +852,7 @@ static int nDPIsrvd_parse_options(int argc, char ** argv) "Usage: %s [-l] [-L logfile] [-c path-to-unix-sock] [-d] [-p pidfile]\n" "\t[-s path-to-distributor-unix-socket] [-S distributor-host:port]\n" "\t[-m max-remote-descriptors] [-u user] [-g group]\n" - "\t[-C max-buffered-collector-json-lines] [-D]\n" + "\t[-C max-buffered-json-lines] [-D]\n" "\t[-v] [-h]\n", argv[0]); return 1; @@ -1428,7 +1431,7 @@ static int mainloop(int epollfd) if (fdsi.ssi_signo == SIGINT || fdsi.ssi_signo == SIGTERM || fdsi.ssi_signo == SIGQUIT) { nDPIsrvd_main_thread_shutdown = 1; - break; + continue; } } else -- cgit v1.2.3