Commit 13ea5e83 authored by Hirofumi Ogawa's avatar Hirofumi Ogawa Committed by Linus Torvalds

[PATCH] lib/parser: Not recognize nul string as "%s" (6/6)

Current match_token recognize "foo=" as "foo=%s". So this change the
nul string does not recognize as "%s".
parent 5163200e
...@@ -45,7 +45,9 @@ static int match_one(char *s, char *p, substring_t args[]) ...@@ -45,7 +45,9 @@ static int match_one(char *s, char *p, substring_t args[])
args[argc].from = s; args[argc].from = s;
switch (*p++) { switch (*p++) {
case 's': case 's':
if (len == -1 || len > strlen(s)) if (strlen(s) == 0)
return 0;
else if (len == -1 || len > strlen(s))
len = strlen(s); len = strlen(s);
args[argc].to = s + len; args[argc].to = s + len;
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment