chiark / gitweb /
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)
committerSven Eden <yamakuzure@gmx.net>
Fri, 24 Aug 2018 14:47:08 +0000 (16:47 +0200)
This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827.

src/basic/time-util.c

index 71d6179efacd8156f397b29138452a59125b30ec..2e465296fca739645a9c2ed017e0e89cc2639146 100644 (file)
@@ -1326,6 +1326,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);