[netfilter-cvslog] r6683 - trunk/iptables/extensions

kaber at netfilter.org kaber at netfilter.org
Tue Oct 10 08:18:40 CEST 2006


Author: kaber at netfilter.org
Date: 2006-10-10 08:18:40 +0200 (Tue, 10 Oct 2006)
New Revision: 6683

Modified:
   trunk/iptables/extensions/libip6t_LOG.c
   trunk/iptables/extensions/libipt_LOG.c
   trunk/iptables/extensions/libipt_ULOG.c
Log:
[PATCH]: iptables segfaults when given "" to --log-prefix (Mike Frysinger <vapier at gentoo.org>)

Bugzilla #516


Modified: trunk/iptables/extensions/libip6t_LOG.c
===================================================================
--- trunk/iptables/extensions/libip6t_LOG.c	2006-10-09 18:00:11 UTC (rev 6682)
+++ trunk/iptables/extensions/libip6t_LOG.c	2006-10-10 06:18:40 UTC (rev 6683)
@@ -143,6 +143,10 @@
 				   "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");

Modified: trunk/iptables/extensions/libipt_LOG.c
===================================================================
--- trunk/iptables/extensions/libipt_LOG.c	2006-10-09 18:00:11 UTC (rev 6682)
+++ trunk/iptables/extensions/libipt_LOG.c	2006-10-10 06:18:40 UTC (rev 6683)
@@ -143,6 +143,10 @@
 				   "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");

Modified: trunk/iptables/extensions/libipt_ULOG.c
===================================================================
--- trunk/iptables/extensions/libipt_ULOG.c	2006-10-09 18:00:11 UTC (rev 6682)
+++ trunk/iptables/extensions/libipt_ULOG.c	2006-10-10 06:18:40 UTC (rev 6683)
@@ -110,6 +110,14 @@
 				   "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;




More information about the netfilter-cvslog mailing list