aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2021-06-03 15:15:57 -0700
committerRob Landley <rob@landley.net>2021-06-04 03:25:47 -0500
commit0842ada4d6982f1b4c06a1bf08403961ca95f0bc (patch)
tree1f00b95a3b6f4fdca0f1958d8e55760924ab4933 /toys
parentd02da4ec606c82108a589826730eefb01c5ca2ed (diff)
downloadtoybox-0842ada4d6982f1b4c06a1bf08403961ca95f0bc.tar.gz
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.
Diffstat (limited to 'toys')
-rw-r--r--toys/pending/modprobe.c3
1 files changed, 2 insertions, 1 deletions
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;