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>
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)))