]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
iptables segfaults when given "" to --log-prefix (Mike Frysinger <vapier@gentoo.org>)
authorMike Frysinger <vapier@gentoo.org>
Tue, 10 Oct 2006 06:18:40 +0000 (06:18 +0000)
committerPatrick McHardy <kaber@trash.net>
Tue, 10 Oct 2006 06:18:40 +0000 (06:18 +0000)
Bugzilla #516

extensions/libip6t_LOG.c
extensions/libipt_LOG.c
extensions/libipt_ULOG.c

index a9c8965dcb51fda7f3b7fba437ce5dafdcfba310..5043b44e813e96f8f27d02f5b44b8f18e248105a 100644 (file)
@@ -143,6 +143,10 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                                   "Maximum prefix length %u for --log-prefix",
                                   (unsigned int)sizeof(loginfo->prefix) - 1);
 
+               if (strlen(optarg) == 0)
+                       exit_error(PARAMETER_PROBLEM,
+                                  "No prefix specified for --log-prefix");
+
                if (strlen(optarg) != strlen(strtok(optarg, "\n")))
                        exit_error(PARAMETER_PROBLEM,
                                   "Newlines not allowed in --log-prefix");
index 5e5d3fd865cb5a929000c22e7583741c0fb8a099..96cc70108a63d8f1f321622dfb8c6889da2ea558 100644 (file)
@@ -143,6 +143,10 @@ parse(int c, char **argv, int invert, unsigned int *flags,
                                   "Maximum prefix length %u for --log-prefix",
                                   (unsigned int)sizeof(loginfo->prefix) - 1);
 
+               if (strlen(optarg) == 0)
+                       exit_error(PARAMETER_PROBLEM,
+                                  "No prefix specified for --log-prefix");
+
                if (strlen(optarg) != strlen(strtok(optarg, "\n")))
                        exit_error(PARAMETER_PROBLEM,
                                   "Newlines not allowed in --log-prefix");
index f4b7a14a0110acb1aa187eaa0941e0053fc56d03..a73b685fcde32ce75f0c6425e3a46cd71ad31c17 100644 (file)
@@ -110,6 +110,14 @@ static int parse(int c, char **argv, int invert, unsigned int *flags,
                                   "Maximum prefix length %u for --ulog-prefix",
                                   (unsigned int)sizeof(loginfo->prefix) - 1);
 
+               if (strlen(optarg) == 0)
+                       exit_error(PARAMETER_PROBLEM,
+                                  "No prefix specified for --ulog-prefix");
+
+               if (strlen(optarg) != strlen(strtok(optarg, "\n")))
+                       exit_error(PARAMETER_PROBLEM,
+                                  "Newlines not allowed in --ulog-prefix");
+
                strcpy(loginfo->prefix, optarg);
                *flags |= IPT_LOG_OPT_PREFIX;
                break;