summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org>2006-10-10 06:18:40 +0000
committer/C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org </C=DE/ST=Berlin/L=Berlin/O=Netfilter Project/OU=Development/CN=kaber/emailAddress=kaber@netfilter.org>2006-10-10 06:18:40 +0000
commit689107ec4d1f15e872b859f4ac9e1bffd06be9fe (patch)
tree7b7f68498d37bef33fc6ad83b8931af5af8dec0d
parentd128b2b3b044b8005b2f7c2a46196c3376eac7ad (diff)
[PATCH]: iptables segfaults when given "" to --log-prefix (Mike Frysinger <vapier@gentoo.org>)
Bugzilla #516
-rw-r--r--extensions/libip6t_LOG.c4
-rw-r--r--extensions/libipt_LOG.c4
-rw-r--r--extensions/libipt_ULOG.c8
3 files changed, 16 insertions, 0 deletions
diff --git a/extensions/libip6t_LOG.c b/extensions/libip6t_LOG.c
index a9c8965..5043b44 100644
--- a/extensions/libip6t_LOG.c
+++ b/extensions/libip6t_LOG.c
@@ -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");
diff --git a/extensions/libipt_LOG.c b/extensions/libipt_LOG.c
index 5e5d3fd..96cc701 100644
--- a/extensions/libipt_LOG.c
+++ b/extensions/libipt_LOG.c
@@ -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");
diff --git a/extensions/libipt_ULOG.c b/extensions/libipt_ULOG.c
index f4b7a14..a73b685 100644
--- a/extensions/libipt_ULOG.c
+++ b/extensions/libipt_ULOG.c
@@ -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;