From: Ken Raeburn Date: Sat, 28 Aug 2004 02:05:39 +0000 (+0000) Subject: * prof_parse.c (parse_std_line): Rewrite handling of whitespace in and after X-Git-Tag: krb5-1.4-beta1~115 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=7bdd2428a3b95eafadd7f337020b4ff12ad0f5dc;p=krb5.git * prof_parse.c (parse_std_line): Rewrite handling of whitespace in and after tag, to strip trailing whitespace (per current locale, not just ASCII space characters), and prohibit any internal space characters in tag names. (This is not the patch supplied in the bug report; that patch changed the tag handling to allow spaces in tag names, which we haven't previously allowed. On the other hand, we haven't specifically disallowed internal tabs or other whitespace, either, and this patch does so.) ticket: 2614 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16697 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/util/profile/ChangeLog b/src/util/profile/ChangeLog index 1e4331b40..c7b4be1e1 100644 --- a/src/util/profile/ChangeLog +++ b/src/util/profile/ChangeLog @@ -1,5 +1,10 @@ 2004-08-27 Ken Raeburn + * prof_parse.c (parse_std_line): Rewrite handling of whitespace in + and after tag, to strip trailing whitespace (per current locale, + not just ASCII space characters), and prohibit any internal space + characters in tag names. + * profile.swg: New file. * configure.in: Look for Tcl. * Makefile.in (profile_tcl, profile_tcl.c, profile_tcl.o): New diff --git a/src/util/profile/prof_parse.c b/src/util/profile/prof_parse.c index 87966f05e..042379dd2 100644 --- a/src/util/profile/prof_parse.c +++ b/src/util/profile/prof_parse.c @@ -146,13 +146,22 @@ static errcode_t parse_std_line(char *line, struct parse_state *state) cp = strchr(cp, '='); if (!cp) return PROF_RELATION_SYNTAX; + if (cp == tag) + return PROF_RELATION_SYNTAX; *cp = '\0'; - p = strchr(tag, ' '); - if (p) { - *p = '\0'; - p = skip_over_blanks(p+1); - if (p != cp) - return PROF_RELATION_SYNTAX; + p = tag; + /* Look for whitespace on left-hand side. */ + while (p < cp && !isspace((int)*p)) + p++; + if (p < cp) { + /* Found some sort of whitespace. */ + *p++ = 0; + /* If we have more non-whitespace, it's an error. */ + while (p < cp) { + if (!isspace((int)*p)) + return PROF_RELATION_SYNTAX; + p++; + } } cp = skip_over_blanks(cp+1); value = cp;