From 663cbf8177ffc23dd442cf997ee4e4e58b737bd2 Mon Sep 17 00:00:00 2001 From: ruti <> Date: Sun, 8 Sep 2024 16:50:21 +0300 Subject: [PATCH] fix integer overflow and unhandled error --- conev.h | 4 ++-- proxy.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conev.h b/conev.h index eed9079..4a8d928 100644 --- a/conev.h +++ b/conev.h @@ -68,7 +68,7 @@ struct buffer { struct eval { int fd; int index; - unsigned int mod_iter; + unsigned long long mod_iter; enum eid type; struct eval *pair; struct buffer buff; @@ -93,7 +93,7 @@ struct poolhd { #else struct pollfd *pevents; #endif - unsigned int iters; + unsigned long long iters; }; struct poolhd *init_pool(int count); diff --git a/proxy.c b/proxy.c index 8674131..c20f753 100644 --- a/proxy.c +++ b/proxy.c @@ -482,7 +482,7 @@ int udp_associate(struct poolhd *pool, return -1; } struct eval *client = add_event(pool, EV_UDP_TUNNEL, cfd, POLLIN); - if (!pair) { + if (!client) { del_event(pool, pair); close(cfd); return -1; @@ -880,7 +880,7 @@ int event_loop(int srvfd) } assert(val->type >= 0 && val->type < sizeof(eid_name)/sizeof(*eid_name)); - LOG(LOG_L, "new event: fd: %d, evt: %s, mod_iter: %d\n", val->fd, eid_name[val->type], val->mod_iter); + LOG(LOG_L, "new event: fd: %d, evt: %s, mod_iter: %llu\n", val->fd, eid_name[val->type], val->mod_iter); switch (val->type) { case EV_ACCEPT: