(Problem reported by RELAUNCH DEPT. (GitHub: ceodaradigu).)
* NEWS: Mention this.
* zic.c (namecheck) [_WIN32 || __CYGWIN__]:
Disallow ':' and '\' in file names.
---
 NEWS  | 4 ++++
 zic.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/NEWS b/NEWS
index aade45d4..321f1711 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,10 @@ Unreleased, experimental changes
 
     localtime.c now works again by default on AIX and DragonFly BSD.
 
+    zic now rejects ‘:’ and ‘\’ in Zone and Link names when running on
+    Microsoft Windows.  (Problem reported by RELAUNCH DEPT. (GitHub:
+    ceodaradigu).)
+
   Changes to documentation
 
     URLs for release tarballs in tz-link.html have been updated to
diff --git a/zic.c b/zic.c
index fb9ac97a..6e18893a 100644
--- a/zic.c
+++ b/zic.c
@@ -1464,6 +1464,12 @@ namecheck(const char *name)
        register char const *component = name;
        for (cp = name; *cp; cp++) {
                unsigned char c = *cp;
+#if defined _WIN32 || defined __CYGWIN__
+               if (c == ':' || c == '\\') {
+                 error(N_("file name '%s' contains '%c'"), name, c);
+                 return false;
+               }
+#endif
                if (noise && !strchr(benign, c)) {
                        warning((strchr(printable_and_not_benign, c)
                                 ? N_("file name '%s' contains byte '%c'")
-- 
2.55.0

Reply via email to