]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
Replace memchr with strlen and fix up one of the statements.
authorMartin Josefsson <gandalf@wlug.westbo.se>
Mon, 3 Jan 2005 07:46:07 +0000 (07:46 +0000)
committerMartin Josefsson <gandalf@wlug.westbo.se>
Mon, 3 Jan 2005 07:46:07 +0000 (07:46 +0000)
iptables.c

index 3cedaccf72d5d6fd5e82b0b47608a0fd4772ef64..7144b39317688ded569437b64785849cc9c7ed03 100644 (file)
@@ -1090,8 +1090,8 @@ register_match(struct iptables_match *me)
                exit(1);
        }
 
-       /* Revision field stole a char: check for 30 char names. */
-       if (!memchr(me->name, 0, IPT_FUNCTION_MAXNAMELEN-1)) {
+       /* Revision field stole a char from name. */
+       if (strlen(me->name) >= IPT_FUNCTION_MAXNAMELEN-1) {
                fprintf(stderr, "%s: target `%s' has invalid name\n",
                        program_name, me->name);
                exit(1);
@@ -1146,8 +1146,8 @@ register_target(struct iptables_target *me)
                exit(1);
        }
 
-       /* Revision field stole a char: check for 30 char names. */
-       if (!memchr(me->name, 0, IPT_FUNCTION_MAXNAMELEN)) {
+       /* Revision field stole a char from name. */
+       if (strlen(me->name) >= IPT_FUNCTION_MAXNAMELEN-1) {
                fprintf(stderr, "%s: target `%s' has invalid name\n",
                        program_name, me->name);
                exit(1);