util-lib: reject too long path for timedate_is_valid()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Jun 2018 03:31:02 +0000 (12:31 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 11 Jun 2018 03:38:34 +0000 (12:38 +0900)
This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827.

src/basic/time-util.c

index 031b871..64ee777 100644 (file)
@@ -1311,6 +1311,9 @@ bool timezone_is_valid(const char *name, int log_level) {
         if (slash)
                 return false;
 
+        if (p - name >= PATH_MAX)
+                return false;
+
         t = strjoina("/usr/share/zoneinfo/", name);
 
         fd = open(t, O_RDONLY|O_CLOEXEC);