From nobody Sat Jan 14 17:20:05 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NvQ5d3XZpz2sXn7; Sat, 14 Jan 2023 17:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NvQ5d2qtRz3x1Z; Sat, 14 Jan 2023 17:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673716805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j40RMSlV5vWBr9CXIc4vsBe9GqFwKHzevGm0Ge0V1O8=; b=EwCcDTy7sWRCjhFQWhGOllg7V58vieOrZbHrSzoH8Ggd/4ZgWTlexQq+4noBOHZ2VSii/F FLi9ybmlF5/eKi7VKybnhI0WSlu0w3eaMc/jq7xSI+mEm2KE4ZKzE63NfpaGXZkg83bOur Gdifj8dspbK0lFPC/prjz89LOtBEKMMXTtF0XK8CMRurSxDipyd8jFo9BfdHaR6/ZGpmsQ UzTkCK+Anlpi+mqP0ZiSV6gPIf3l3Z5HmSZ6cn7I8REaaWc3GhqFxhlYs1XssvZU4MHPqY OAAXTAOVgBeFcMH2FIjW9mbqGIlh5HWZpYMt7gmVS2OFMSbrxMfg+dVr3UlgiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1673716805; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=j40RMSlV5vWBr9CXIc4vsBe9GqFwKHzevGm0Ge0V1O8=; b=nQ7lD49FeJvzTjLKLjFn1EoOdQqfG71U1FROtGahkHYnwDJxYYPeem0IbWdLRP3vbRjl9U jKM43avT38aWuUXMCWqqJdd9LUAP7qTCCE9vPTamnykfh5RvchBSC7le4zG9Y+NOEz01LW AhqcY6LG6OMZzKjNSyFD6PYVPQlIjbGYvaKpdLJe+3fHN9BSbAE79+VolPFLLUQAX9n7Uw PKUwBtAPn/dVDAFG2UZz+MnfR/C1Hmp+CbSjdpkDu4jJmEv+HviZOCUTHPgtXVJnUQaLl2 eH7sh8yQ6Ba3OkiOe6UgUz2X/3JiQBZtJwyYbFBgWvUHrOLzCG++aSPsN7uJGg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1673716805; a=rsa-sha256; cv=none; b=WkksQdWYvuCXuurwuJ9e3S/6i89xLCaMfbs2LyQUthOI4rqBXTfFAGejtU6/DE474irAvh 4sljzPrA3yPOyoeMYYcfaxAjLV/DVTpNMrJGAKEaLbiHCxUsmE7LiQSQBhiz+FyKczwY2q zD1flk6YQz9OeOV6WNXE4PCKYPZyz6j37Ok4kQsP2Jqo54IrH4x27PpdU8cYjEyQ5ME9xw m8NSQSCwPAopwHxgH0QcOY4yjZ5P6gx9s0zqs9Lh5Ou0sXX59iVbWHDph3wY8kIK7gekgJ dKDC5y7ROmUjrH8VFHzDA0v3EqIcz1bDwSYKzN32VHxDtr4mglDOw1ugaSqqAQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NvQ5d1vvfzw0B; Sat, 14 Jan 2023 17:20:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30EHK5QY049657; Sat, 14 Jan 2023 17:20:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30EHK5RI049654; Sat, 14 Jan 2023 17:20:05 GMT (envelope-from git) Date: Sat, 14 Jan 2023 17:20:05 GMT Message-Id: <202301141720.30EHK5RI049654@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Dag-Erling=20Sm=C3=B8rgrav?= Subject: git: 3e2e5eebfaa0 - main - tzcode: Remove access() again, cf. 02ba1d993fa9. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: des X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e2e5eebfaa0aebb2790bbde7f35d4c6c52e2596 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by des: URL: https://cgit.FreeBSD.org/src/commit/?id=3e2e5eebfaa0aebb2790bbde7f35d4c6c52e2596 commit 3e2e5eebfaa0aebb2790bbde7f35d4c6c52e2596 Author: Dag-Erling Smørgrav AuthorDate: 2023-01-13 14:54:21 +0000 Commit: Dag-Erling Smørgrav CommitDate: 2023-01-14 17:16:17 +0000 tzcode: Remove access() again, cf. 02ba1d993fa9. Reported by: Coverity (CID 1250126) MFC after: 1 week Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D38035 --- contrib/tzcode/localtime.c | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index 2dbab26509d3..30ae18a965e8 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -468,7 +468,6 @@ tzloadbody(char const *name, struct state *sp, bool doextend, register int fid; register int stored; register ssize_t nread; - register bool doaccess; register union input_buffer *up = &lsp->u.u; register int tzheadsize = sizeof(struct tzhead); @@ -482,15 +481,7 @@ tzloadbody(char const *name, struct state *sp, bool doextend, if (name[0] == ':') ++name; -#ifdef SUPPRESS_TZDIR - /* Do not prepend TZDIR. This is intended for specialized - applications only, due to its security implications. */ - doaccess = true; -#else - doaccess = name[0] == '/'; -#endif - if (!doaccess) { - char const *dot; + if (name[0] != '/') { if (sizeof lsp->fullname - sizeof tzdirslash <= strlen(name)) return ENAMETOOLONG; @@ -500,20 +491,8 @@ tzloadbody(char const *name, struct state *sp, bool doextend, memcpy(lsp->fullname, tzdirslash, sizeof tzdirslash); strcpy(lsp->fullname + sizeof tzdirslash, name); - /* Set doaccess if NAME contains a ".." file name - component, as such a name could read a file outside - the TZDIR virtual subtree. */ - for (dot = name; (dot = strchr(dot, '.')); dot++) - if ((dot == name || dot[-1] == '/') && dot[1] == '.' - && (dot[2] == '/' || !dot[2])) { - doaccess = true; - break; - } - name = lsp->fullname; } - if (doaccess && access(name, R_OK) != 0) - return errno; if (doextend) { /* * Detect if the timezone file has changed. Check