]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/address: minor cleanups
authorVictor Julien <victor@inliniac.net>
Tue, 14 Apr 2020 06:01:37 +0000 (08:01 +0200)
committerVictor Julien <victor@inliniac.net>
Tue, 28 Apr 2020 10:05:39 +0000 (12:05 +0200)
src/detect-engine-address.c

index 62b881f2ae844d8c568f10683f4be4d7372baa18..265b0bec33f711be5fc9028f5b33bd4fdaf0b7b1 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2020 Open Information Security Foundation
  *
  * You can copy, redistribute or modify this Program under the terms of
  * the GNU General Public License version 2 as published by the Free
@@ -21,9 +21,6 @@
  * \author Victor Julien <victor@inliniac.net>
  *
  * Address part of the detection engine.
- *
- * \todo Move this out of the detection plugin structure
- *       rename to detect-engine-address.c
  */
 
 #include "suricata-common.h"
@@ -81,7 +78,6 @@ void DetectAddressFree(DetectAddress *ag)
         return;
 
     SCFree(ag);
-
     return;
 }
 
@@ -558,12 +554,11 @@ int DetectAddressParseString(DetectAddress *dd, const char *str)
             mask++;
             uint32_t ip4addr = 0;
             uint32_t netmask = 0;
-            size_t u = 0;
 
             if ((strchr (mask, '.')) == NULL) {
                 /* 1.2.3.4/24 format */
 
-                for (u = 0; u < strlen(mask); u++) {
+                for (size_t u = 0; u < strlen(mask); u++) {
                     if(!isdigit((unsigned char)mask[u]))
                         goto error;
                 }
@@ -630,7 +625,7 @@ int DetectAddressParseString(DetectAddress *dd, const char *str)
 
             int cidr = atoi(mask);
             if (cidr < 0 || cidr > 128)
-                    goto error;
+                goto error;
 
             r = inet_pton(AF_INET6, ip, &in6);
             if (r <= 0)