mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib/parser: Not recognize nul string as "%s" (6/6)
@ 2003-10-06 16:58 OGAWA Hirofumi
  2003-10-06 17:36 ` Randy.Dunlap
  0 siblings, 1 reply; 2+ messages in thread
From: OGAWA Hirofumi @ 2003-10-06 16:58 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

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>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] lib/parser: Not recognize nul string as "%s" (6/6)
  2003-10-06 16:58 [PATCH] lib/parser: Not recognize nul string as "%s" (6/6) OGAWA Hirofumi
@ 2003-10-06 17:36 ` Randy.Dunlap
  0 siblings, 0 replies; 2+ messages in thread
From: Randy.Dunlap @ 2003-10-06 17:36 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: torvalds, linux-kernel

On Tue, 07 Oct 2003 01:58:47 +0900 OGAWA Hirofumi <hirofumi@mail.parknet.co.jp> wrote:

| 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?)

I like the check here.

And thanks for doing all of these updates.


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


--
~Randy

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2003-10-06 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-10-06 16:58 [PATCH] lib/parser: Not recognize nul string as "%s" (6/6) OGAWA Hirofumi
2003-10-06 17:36 ` Randy.Dunlap

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®