From 3cec34a443c76e06a21f0be01ce9eac936c8a6d4 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Mon, 11 Jun 2018 12:31:02 +0900 Subject: [PATCH] util-lib: reject too long path for timedate_is_valid() This should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=8827. --- src/basic/time-util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/basic/time-util.c b/src/basic/time-util.c index 71d6179ef..2e465296f 100644 --- a/src/basic/time-util.c +++ b/src/basic/time-util.c @@ -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); -- 2.30.2