From dd587ca6c30f8b594828be8f8d84a1629db3b39e Mon Sep 17 00:00:00 2001 From: Mikhail Efremov Date: Tue, 20 Jan 2015 21:54:59 +0300 Subject: [PATCH] Fix valid_ipv4addr(). Fix first byte check. --- alterator-net-functions/alterator-net-functions | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/alterator-net-functions/alterator-net-functions b/alterator-net-functions/alterator-net-functions index f80b5ae..30fc504 100644 --- a/alterator-net-functions/alterator-net-functions +++ b/alterator-net-functions/alterator-net-functions @@ -46,7 +46,8 @@ valid_ipv4addr() i=$(($i+1)) done - [ $i -eq 2 ] 2>/dev/null || + [ $i -eq 2 -a \ + "$byte" -gt 0 -a "$byte" -lt 255 ] 2>/dev/null || return 1 }