From 13ea5e83c74ab3c26789882deadc86fc64e4d432 Mon Sep 17 00:00:00 2001 From: Hirofumi Ogawa Date: Sun, 5 Oct 2003 21:02:22 -0700 Subject: [PATCH] [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". --- lib/parser.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/parser.c b/lib/parser.c index 858061397fe2b..790ec2a858d7e 100644 --- a/lib/parser.c +++ b/lib/parser.c @@ -45,7 +45,9 @@ static int match_one(char *s, char *p, substring_t args[]) args[argc].from = s; switch (*p++) { case 's': - if (len == -1 || len > strlen(s)) + if (strlen(s) == 0) + return 0; + else if (len == -1 || len > strlen(s)) len = strlen(s); args[argc].to = s + len; break; -- 2.53.0