From ea5bfb52e0059f95380c763377c528d336826c1a Mon Sep 17 00:00:00 2001 From: liyang Date: Tue, 6 Oct 2020 21:55:21 +0800 Subject: [PATCH] fix bug about stack corrupt for example ip address is spceial "172.16.107.7, Proxy:False, 210.3.213.69" --- binding/c/ip2region.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/binding/c/ip2region.c b/binding/c/ip2region.c index 53ccba7..a6abaf3 100644 --- a/binding/c/ip2region.c +++ b/binding/c/ip2region.c @@ -401,12 +401,12 @@ IP2R_API uint_t ip2long(const char *ip) continue; } + if ( i > 3 ) { + ipval = 0; + break; + } if ( *cs == '.' ) { //single part length limit - if ( i > 3 ) { - ipval = 0; - break; - } if ( p < 0 ) break; buffer[i] = '\0';