From e6d48ea1417b7ddab0f16297b6f595ad161e0a80 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Mon, 24 Jan 2022 11:31:37 -0800 Subject: [PATCH] rc-misc.c: Allocate memory for 'file' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is a partial revert of commit 8e02406d ("rc-misc.c: remove references to PATH_MAX"), which changed 'file' to a null pointer with no associated storage. ../openrc-0.44.10/src/rc/rc-misc.c: In function ‘_rc_deptree_load’: ../openrc-0.44.10/src/rc/rc-misc.c:392:33: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 392 | eerror("Clock skew detected with `%s'", file); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Fixes: 8e02406d ("rc-misc.c: remove references to PATH_MAX") Closes: #493 --- src/rc/rc-misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rc/rc-misc.c b/src/rc/rc-misc.c index 99a60fe4..1ca51e72 100644 --- a/src/rc/rc-misc.c +++ b/src/rc/rc-misc.c @@ -362,7 +362,7 @@ RC_DEPTREE * _rc_deptree_load(int force, int *regen) int serrno = errno; int merrno; time_t t; - char *file = NULL; + char file[PATH_MAX]; struct stat st; struct utimbuf ut; FILE *fp;