From b77f1dafb9f35752bb9685323bcacb32a0e6ddc5 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 14 Mar 2002 11:35:58 +0000 Subject: Fix 'iptables -p !' bug (segfault when `!' used without argument) --- extensions/libipt_owner.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'extensions/libipt_owner.c') diff --git a/extensions/libipt_owner.c b/extensions/libipt_owner.c index 30ee0c11..96631220 100644 --- a/extensions/libipt_owner.c +++ b/extensions/libipt_owner.c @@ -61,9 +61,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, struct passwd *pwd; struct group *grp; case '1': - if (check_inverse(optarg, &invert)) - optind++; - + check_inverse(optarg, &invert, &optind, 0); if ((pwd = getpwnam(optarg))) ownerinfo->uid = pwd->pw_uid; else { @@ -78,8 +76,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, break; case '2': - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); if ((grp = getgrnam(optarg))) ownerinfo->gid = grp->gr_gid; else { @@ -94,8 +91,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, break; case '3': - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); ownerinfo->pid = strtoul(optarg, &end, 0); if (*end != '\0' || end == optarg) exit_error(PARAMETER_PROBLEM, "Bad OWNER PID value `%s'", optarg); @@ -106,8 +102,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, break; case '4': - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); ownerinfo->sid = strtoul(optarg, &end, 0); if (*end != '\0' || end == optarg) exit_error(PARAMETER_PROBLEM, "Bad OWNER SID value `%s'", optarg); @@ -119,8 +114,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, #ifdef IPT_OWNER_COMM case '5': - if (check_inverse(optarg, &invert)) - optind++; + check_inverse(optarg, &invert, &optind, 0); if(strlen(optarg) > sizeof(ownerinfo->comm)) exit_error(PARAMETER_PROBLEM, "OWNER CMD `%s' too long, max %d characters", optarg, sizeof(ownerinfo->comm)); -- cgit v1.2.3