From e34aef9981199988f215ae34bc2d1348853d0c77 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Wed, 20 Sep 2023 12:43:44 -0300 Subject: [PATCH] Move increment of `octets` --- src/isinetaddr4.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/isinetaddr4.c b/src/isinetaddr4.c index bfb5195..9cdb8eb 100644 --- a/src/isinetaddr4.c +++ b/src/isinetaddr4.c @@ -35,14 +35,13 @@ isinetaddr4(const char *str) digits++; if (!in_range(buf)) { return 0; + } else if (str[l-1] == SEP) { + octets++; } } } else { return 0; } - if (str[l-1] == SEP) { - octets++; - } } return octets == MAX_OCTETS && digits <= MAX_DIGITLEN; }