From ab9b7c6fca9126b1e22fbc0556993530d9d1d914 Mon Sep 17 00:00:00 2001 From: Vladimir Dubrovin <3proxy@3proxy.ru> Date: Wed, 22 Apr 2026 12:00:12 +0300 Subject: [PATCH] fix inithashtable call --- src/conf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/conf.c b/src/conf.c index dd6d082..e159243 100644 --- a/src/conf.c +++ b/src/conf.c @@ -662,7 +662,7 @@ static int h_nscache(int argc, unsigned char **argv){ fprintf(stderr, "Invalid NS cache size: %d\n", res); return 1; } - if(dns_table.growlimit != res && inithashtable(&dns_table, (res << 2), (res << 2), res)){ + if(dns_table.growlimit != res && inithashtable(&dns_table, (res >> 2), (res >> 2), res)){ fprintf(stderr, "Failed to initialize NS cache\n"); return 2; } @@ -685,7 +685,7 @@ static int h_nscache6(int argc, unsigned char **argv){ fprintf(stderr, "Invalid NS cache size: %d\n", res); return 1; } - if(dns6_table.growlimit != res &&inithashtable(&dns6_table, (res<<2), (res<<2), res)){ + if(dns6_table.growlimit != res &&inithashtable(&dns6_table, (res>>2), (res>>2), res)){ fprintf(stderr, "Failed to initialize NS cache\n"); return 2; } @@ -1449,7 +1449,7 @@ static int h_authcache(int argc, unsigned char **argv){ if(!conf.authcachetype) conf.authcachetype = 6; if(!conf.authcachetime) conf.authcachetime = 600; if(!authcachesize) authcachesize = 65536*4; - if(auth_table.growlimit != authcachesize && inithashtable(&auth_table, 1024, 1024, authcachesize)){ + if(auth_table.growlimit != authcachesize && inithashtable(&auth_table, authcachesize < 1024? authcachesize:1024, authcachesize < 1024? authcachesize:1024, authcachesize)){ fprintf(stderr, "Failed to initialize auth cache\n"); return 2; }