All of lore.kernel.org
 help / color / mirror / Atom feed
From: Phil Oester <kernel@linuxace.com>
To: netfilter-devel@lists.netfilter.org
Subject: [PATCH] Disallow newlines in LOG target --log-prefix
Date: Tue, 29 Mar 2005 11:34:22 -0800	[thread overview]
Message-ID: <20050329193422.GA12848@linuxace.com> (raw)

[-- 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;

             reply	other threads:[~2005-03-29 19:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-29 19:34 Phil Oester [this message]
2005-04-01  7:03 ` [PATCH] Disallow newlines in LOG target --log-prefix Harald Welte

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050329193422.GA12848@linuxace.com \
    --to=kernel@linuxace.com \
    --cc=netfilter-devel@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.