mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Werner Almesberger <werner@almesberger.net>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>
Subject: [PATCH] boot parameters: quoting of environment variables
Date: Sun, 3 Oct 2004 03:51:36 -0300	[thread overview]
Message-ID: <20041003035136.A15226@almesberger.net> (raw)

The kernel currently allows boot parameters to be quoted (so
that they can contain spaces) in the following way:

param="value"

Unfortunately, when init/main.c:unknown_bootoption reconstructs
the parameter line for environment variables, it does not expect
that there could be two \0s between the parameter name and its
value. My patch corrects this by shifting the parameter name.

The patch is for 2.6.7, but also works with 2.6.8.1. Furthermore,
I've checked that nothing relevant seems to have changed until
2.6.9-rc3.

- Werner

---------------------------------- cut here -----------------------------------

Signed-off-by: Werner Almesberger <werner@almesberger.net>

--- linux-2.6.7/init/main.c.orig	Sun Oct  3 03:27:12 2004
+++ linux-2.6.7/init/main.c	Sun Oct  3 03:44:54 2004
@@ -246,8 +246,14 @@
 static int __init unknown_bootoption(char *param, char *val)
 {
 	/* Change NUL term back to "=", to make "param" the whole string. */
-	if (val)
+	if (val) {
 		val[-1] = '=';
+		/* If the value was quoted, shift the parameter name. */
+		if (!val[-2]) {
+			memmove(param+1,param,strlen(param));
+			param++;
+		}
+	}
 
 	/* Handle obsolete-style parameters */
 	if (obsolete_checksetup(param))

-- 
  _________________________________________________________________________
 / Werner Almesberger, Buenos Aires, Argentina     werner@almesberger.net /
/_http://www.almesberger.net/____________________________________________/

                 reply	other threads:[~2004-10-03  6:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20041003035136.A15226@almesberger.net \
    --to=werner@almesberger.net \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®