From 8190d76086e57a4b07e7ed39af3748a470f53b89 Mon Sep 17 00:00:00 2001 From: C. McEnroe Date: Fri, 21 Aug 2020 16:47:54 -0400 Subject: Use a static buffer for base directory paths --- irc.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'irc.c') diff --git a/irc.c b/irc.c index b87351c..5acc69f 100644 --- a/irc.c +++ b/irc.c @@ -27,7 +27,6 @@ #include #include -#include #include #include #include @@ -61,12 +60,9 @@ void ircConfig(bool insecure, const char *cert, const char *priv) { tls_config_insecure_noverifyname(config); } - const char *path; - const char *dirs; - char buf[PATH_MAX]; if (cert) { - dirs = NULL; - while (NULL != (path = configPath(buf, sizeof(buf), &dirs, cert))) { + const char *dirs = NULL; + for (const char *path; NULL != (path = configPath(&dirs, cert));) { if (priv) { error = tls_config_set_cert_file(config, path); } else { @@ -77,8 +73,8 @@ void ircConfig(bool insecure, const char *cert, const char *priv) { if (error) errx(EX_NOINPUT, "%s: %s", cert, tls_config_error(config)); } if (priv) { - dirs = NULL; - while (NULL != (path = configPath(buf, sizeof(buf), &dirs, priv))) { + const char *dirs = NULL; + for (const char *path; NULL != (path = configPath(&dirs, priv));) { error = tls_config_set_key_file(config, path); if (!error) break; } -- cgit 1.4.1-2-gfad0