mirror of
https://git.kernel.org/pub/scm/utils/kernel/kmod/kmod.git
synced 2024-12-04 09:13:41 +08:00
libkmod-config: fix parsing quoted kernel cmdline on params
We can only accept quoted values, not module names or parameter names.
This commit is contained in:
parent
8df21177fb
commit
31dd40a6b8
@ -517,10 +517,24 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config)
|
|||||||
for (p = buf, modname = buf; *p != '\0' && *p != '\n'; p++) {
|
for (p = buf, modname = buf; *p != '\0' && *p != '\n'; p++) {
|
||||||
if (*p == '"') {
|
if (*p == '"') {
|
||||||
is_quoted = !is_quoted;
|
is_quoted = !is_quoted;
|
||||||
|
|
||||||
|
if (is_quoted) {
|
||||||
|
/* don't consider a module until closing quotes */
|
||||||
|
is_module = false;
|
||||||
|
} else if (param != NULL && value != NULL) {
|
||||||
|
/*
|
||||||
|
* If we are indeed expecting a value and
|
||||||
|
* closing quotes, then this can be considered
|
||||||
|
* a valid option for a module
|
||||||
|
*/
|
||||||
|
is_module = true;
|
||||||
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (is_quoted)
|
if (is_quoted)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
case ' ':
|
case ' ':
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
@ -1 +1 @@
|
|||||||
psmouse.foo psmouse.bar=1 psmouse.foobar="test 1" " notamodule" "noteamodule2 " notamodule3 " quiet rw
|
psmouse.foo psmouse.bar=1 psmouse.foobar="test 1" psmouse."invalid option" " notamodule" "noteamodule2 " notamodule3 quiet rw
|
||||||
|
Loading…
Reference in New Issue
Block a user