All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Disallow newlines in LOG target --log-prefix
@ 2005-03-29 19:34 Phil Oester
  2005-04-01  7:03 ` Harald Welte
  0 siblings, 1 reply; 2+ messages in thread
From: Phil Oester @ 2005-03-29 19:34 UTC (permalink / raw)
  To: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 205 bytes --]

As reported in bugzilla, iptables currently does not complain about
the following:

# iptables -A foo -j LOG --log-prefix 'asdfasdfa
asdf'

Patch below makes it complain, and closes bugzilla #312.

Phil



[-- Attachment #2: patch-logprefix --]
[-- Type: text/plain, Size: 1177 bytes --]

diff -ru iptables-orig/extensions/libip6t_LOG.c iptables-new/extensions/libip6t_LOG.c
--- iptables-orig/extensions/libip6t_LOG.c	2005-02-19 11:19:17.000000000 -0800
+++ iptables-new/extensions/libip6t_LOG.c	2005-03-29 11:30:19.000000000 -0800
@@ -134,6 +134,10 @@
 				   "Maximum prefix length %u for --log-prefix",
 				   (unsigned int)sizeof(loginfo->prefix) - 1);
 
+		if (strlen(optarg) != strlen(strtok(optarg, "\n")))
+			exit_error(PARAMETER_PROBLEM,
+				   "Newlines not allowed in --log-prefix");
+
 		strcpy(loginfo->prefix, optarg);
 		*flags |= IP6T_LOG_OPT_PREFIX;
 		break;
diff -ru iptables-orig/extensions/libipt_LOG.c iptables-new/extensions/libipt_LOG.c
--- iptables-orig/extensions/libipt_LOG.c	2005-02-19 11:19:17.000000000 -0800
+++ iptables-new/extensions/libipt_LOG.c	2005-03-29 11:27:54.000000000 -0800
@@ -143,6 +143,10 @@
 				   "Maximum prefix length %u for --log-prefix",
 				   (unsigned int)sizeof(loginfo->prefix) - 1);
 
+		if (strlen(optarg) != strlen(strtok(optarg, "\n")))
+			exit_error(PARAMETER_PROBLEM,
+				   "Newlines not allowed in --log-prefix");
+
 		strcpy(loginfo->prefix, optarg);
 		*flags |= IPT_LOG_OPT_PREFIX;
 		break;

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Disallow newlines in LOG target --log-prefix
  2005-03-29 19:34 [PATCH] Disallow newlines in LOG target --log-prefix Phil Oester
@ 2005-04-01  7:03 ` Harald Welte
  0 siblings, 0 replies; 2+ messages in thread
From: Harald Welte @ 2005-04-01  7:03 UTC (permalink / raw)
  To: Phil Oester; +Cc: netfilter-devel

[-- Attachment #1: Type: text/plain, Size: 812 bytes --]

Thanks again, Phil.

On Tue, Mar 29, 2005 at 11:34:22AM -0800, Phil Oester wrote:
> As reported in bugzilla, iptables currently does not complain about
> the following:
> 
> # iptables -A foo -j LOG --log-prefix 'asdfasdfa
> asdf'
> 
> Patch below makes it complain, and closes bugzilla #312.

Sending        extensions/libip6t_LOG.c
Sending        extensions/libipt_LOG.c
Transmitting file data ..
Committed revision 3819.

-- 
- Harald Welte <laforge@netfilter.org>                 http://netfilter.org/
============================================================================
  "Fragmentation is like classful addressing -- an interesting early
   architectural error that shows how much experimentation was going
   on while IP was being designed."                    -- Paul Vixie

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-04-01  7:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-03-29 19:34 [PATCH] Disallow newlines in LOG target --log-prefix Phil Oester
2005-04-01  7:03 ` Harald Welte

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.