mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] lib/parser: Not recognize nul string as "%s" (6/6)
Date: Tue, 07 Oct 2003 01:58:47 +0900	[thread overview]
Message-ID: <87wubinvzs.fsf@devron.myhome.or.jp> (raw)

Hi,

Current match_token recognize "foo=" as "foo=%s". So this change the
nul string does not recognize as "%s".

(Umm... this should be check by caller?)



 linux-2.6.0-test6-hirofumi/lib/parser.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN lib/parser.c~parser-zero-string lib/parser.c
--- linux-2.6.0-test6/lib/parser.c~parser-zero-string	2003-10-07 01:51:51.000000000 +0900
+++ linux-2.6.0-test6-hirofumi/lib/parser.c	2003-10-07 01:51:51.000000000 +0900
@@ -45,7 +45,9 @@ static int match_one(char *s, char *p, s
 		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;

_

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

             reply	other threads:[~2003-10-06 17:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-10-06 16:58 OGAWA Hirofumi [this message]
2003-10-06 17:36 ` Randy.Dunlap

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wubinvzs.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®