summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2004-08-28 02:05:39 +0000
committerKen Raeburn <raeburn@mit.edu>2004-08-28 02:05:39 +0000
commit7bdd2428a3b95eafadd7f337020b4ff12ad0f5dc (patch)
tree182d3c16e1e77952dce8b29ec20aef865db43618 /src
parentcb531c31cca130913eee32e5c9b9dd7677bebb9b (diff)
downloadkrb5-7bdd2428a3b95eafadd7f337020b4ff12ad0f5dc.tar.gz
krb5-7bdd2428a3b95eafadd7f337020b4ff12ad0f5dc.tar.xz
krb5-7bdd2428a3b95eafadd7f337020b4ff12ad0f5dc.zip
* 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
Diffstat (limited to 'src')
-rw-r--r--src/util/profile/ChangeLog5
-rw-r--r--src/util/profile/prof_parse.c21
2 files changed, 20 insertions, 6 deletions
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 <raeburn@mit.edu>
+ * 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;