From: Bernhard Voelker <mail@bernhard-voelker.de>
To: "util-linux@vger.kernel.org" <util-linux@vger.kernel.org>
Subject: [PATCH] libmount: avoid endless loop in, mnt_get_kernel_cmdline_option
Date: Fri, 30 Nov 2012 17:14:29 +0100 [thread overview]
Message-ID: <50B8DB65.60505@bernhard-voelker.de> (raw)
>From 4ddf21607847570e1da3b692276f2a8242bd5af6 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Fri, 30 Nov 2012 17:12:12 +0100
Subject: [PATCH] libmount: avoid endless loop in
mnt_get_kernel_cmdline_option
The above function infloops when the name to search for can only
be found at the beginning of /proc/cmdline but doesn't match,
e.g. when searching for "ro" in "root=/dev/sda1 quiet vga=0x31a".
* libmount/src/utils.c (mnt_get_kernel_cmdline_option): Replace
while by for loop to ensure the pointer p is incremented.
Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
---
libmount/src/utils.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/libmount/src/utils.c b/libmount/src/utils.c
index 74c3ad5..be242d0 100644
--- a/libmount/src/utils.c
+++ b/libmount/src/utils.c
@@ -947,9 +947,7 @@ char *mnt_get_kernel_cmdline_option(const char *name)
if (len && *(name + len - 1) == '=')
val = 1;
- while (p && *p) {
- if (p != buf)
- p++;
+ for ( ; p && *p; p++) {
if (!(p = strstr(p, name)))
break; /* not found the option */
if (p != buf && !isblank(*(p - 1)))
--
1.7.7
next reply other threads:[~2012-11-30 16:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 16:14 Bernhard Voelker [this message]
2012-12-04 15:22 ` [PATCH] libmount: avoid endless loop in, mnt_get_kernel_cmdline_option Bernhard Voelker
2012-12-10 12:44 ` Karel Zak
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=50B8DB65.60505@bernhard-voelker.de \
--to=mail@bernhard-voelker.de \
--cc=util-linux@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