From e4960431d463b4ab1d1a06a4dd55bea7cbccecc1 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 13 May 2018 18:21:09 -0700 Subject: [PROPOSED 2/4] Check for invalid rule name initials MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * zic.c (inrule): Check that rule names do not begin with now-forbidden characters. The rule about what unquoted rule names can contain is harder to check, so don’t bother with that now. --- zic.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/zic.c b/zic.c index 31f1092..0c4c384 100644 --- a/zic.c +++ b/zic.c @@ -1278,8 +1278,13 @@ inrule(char **fields, int nfields) error(_("wrong number of fields on Rule line")); return; } - if (*fields[RF_NAME] == '\0') { - error(_("nameless rule")); + switch (*fields[RF_NAME]) { + case '\0': + case ' ': case '\f': case '\n': case '\r': case '\t': case '\v': + case '+': case '-': + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + error(_("Invalid rule name \"%s\""), fields[RF_NAME]); return; } r.r_filename = filename; -- 2.7.4