From: Miroslav Lichvar Date: Thu, 10 Oct 2019 15:53:58 +0000 (+0200) Subject: use PATH_MAX X-Git-Tag: 4.0-pre1~119 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2fc8edacb810;p=thirdparty%2Fchrony.git use PATH_MAX Include and use the PATH_MAX macro to define the length of buffers containing paths to make it constistent. (It's not supposed to fit all possible paths.) --- diff --git a/logging.c b/logging.c index 9da14faa..9f89f196 100644 --- a/logging.c +++ b/logging.c @@ -266,7 +266,7 @@ LOG_FileWrite(LOG_FileID id, const char *format, ...) return; if (!logfiles[id].file) { - char filename[512], *logdir = CNF_GetLogDir(); + char filename[PATH_MAX], *logdir = CNF_GetLogDir(); if (logdir[0] == '\0') { LOG(LOGS_WARN, "logdir not specified"); diff --git a/ntp_signd.c b/ntp_signd.c index 600329eb..91434f22 100644 --- a/ntp_signd.c +++ b/ntp_signd.c @@ -129,7 +129,7 @@ close_socket(void) static int open_socket(void) { - char path[1024]; + char path[PATH_MAX]; if (sock_fd != INVALID_SOCK_FD) return 1; diff --git a/sources.c b/sources.c index 9ca937ed..5de8507f 100644 --- a/sources.c +++ b/sources.c @@ -1153,7 +1153,7 @@ static FILE *open_dumpfile(SRC_Instance inst, const char *mode) { FILE *f; - char filename[1024], *dumpdir; + char filename[PATH_MAX], *dumpdir; dumpdir = CNF_GetDumpDir(); if (dumpdir[0] == '\0') { @@ -1225,7 +1225,7 @@ SRC_ReloadSources(void) void SRC_RemoveDumpFiles(void) { - char pattern[1024], name[64], *dumpdir, *s; + char pattern[PATH_MAX], name[64], *dumpdir, *s; IPAddr ip_addr; glob_t gl; size_t i; diff --git a/sysincl.h b/sysincl.h index b27afa07..5c8866b1 100644 --- a/sysincl.h +++ b/sysincl.h @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include