From 0842ada4d6982f1b4c06a1bf08403961ca95f0bc Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Thu, 3 Jun 2021 15:15:57 -0700 Subject: modprobe: fix parsing of short lines. The intent here seems to have been to ignore lines with too few arguments to be valid, but since strtok() returns NULL at the end of the string, if you only have "verb noun", you'd be falsely rejected. Since we've kept a count anyway, just check the count. --- toys/pending/modprobe.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'toys') diff --git a/toys/pending/modprobe.c b/toys/pending/modprobe.c index f1c4338e..a3f5bb9e 100644 --- a/toys/pending/modprobe.c +++ b/toys/pending/modprobe.c @@ -238,7 +238,8 @@ static int config_action(struct dirtree *node) break; } } - if (!tk) continue; + // Every command requires at least one argument. + if (tcount < 2) continue; // process the tokens[0] contains first word of config line. if (!strcmp(tokens[0], "alias")) { struct arg_list *temp; -- cgit v1.2.3