From c9d2016a074340cef5b0ef8f47f8612098ce92e5 Mon Sep 17 00:00:00 2001 From: Lakindu Akash Date: Mon, 27 Dec 2021 01:56:39 +0530 Subject: [PATCH] Fix regeex for ip --- src/ui/util.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/ui/util.c b/src/ui/util.c index 25d5c77..067503f 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -126,10 +126,8 @@ int isValidIPaddress(const char * ip){ /* Compile regular expression */ reti = regcomp(®ex, - "^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))." - "([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))." - "([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))." - "([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$", REG_EXTENDED); + "^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])$", + REG_EXTENDED); if (reti) { //printf( "Could not compile regex\n"); return -1;