diff options
author | Lucas De Marchi <lucas.demarchi@intel.com> | 2017-02-16 09:18:35 -0800 |
---|---|---|
committer | Lucas De Marchi <lucas.demarchi@intel.com> | 2017-02-16 09:18:35 -0800 |
commit | 31dd40a6b8fd66127496fc0772b6dbe0a3e5b823 (patch) | |
tree | abbbe4791d25509e624d7ec9311caaeee4598475 /libkmod | |
parent | 8df21177fba3f556d1a3e75d2648c50dfcf09ad0 (diff) | |
download | kmod-31dd40a6b8fd66127496fc0772b6dbe0a3e5b823.tar.gz |
libkmod-config: fix parsing quoted kernel cmdline on params
We can only accept quoted values, not module names or parameter names.
Diffstat (limited to 'libkmod')
-rw-r--r-- | libkmod/libkmod-config.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libkmod/libkmod-config.c b/libkmod/libkmod-config.c index 18f300a..aaac0a1 100644 --- a/libkmod/libkmod-config.c +++ b/libkmod/libkmod-config.c @@ -517,10 +517,24 @@ static int kmod_config_parse_kcmdline(struct kmod_config *config) for (p = buf, modname = buf; *p != '\0' && *p != '\n'; p++) { if (*p == '"') { 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; } if (is_quoted) continue; + switch (*p) { case ' ': *p = '\0'; |