util-lib: reject too long path for timedate_is_valid()

This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827.
This commit is contained in:
Yu Watanabe 2018-06-11 12:31:02 +09:00
parent b05ecb8cad
commit 1c73b60b4d

View 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);