From: Tobias Brunner Date: Tue, 28 Jan 2020 13:55:25 +0000 (+0100) Subject: systime-fix: Replace asctime() with thread-safe asctime_r() X-Git-Tag: 5.8.3dr1~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=18a3e6d80f4402cfb3118ad8bd1f0fe6de938f7c;p=thirdparty%2Fstrongswan.git systime-fix: Replace asctime() with thread-safe asctime_r() According to the man page, the buffer should have room for at least 26 characters. --- diff --git a/src/libcharon/plugins/systime_fix/systime_fix_plugin.c b/src/libcharon/plugins/systime_fix/systime_fix_plugin.c index 3209c91dc0..41ff0831d2 100644 --- a/src/libcharon/plugins/systime_fix/systime_fix_plugin.c +++ b/src/libcharon/plugins/systime_fix/systime_fix_plugin.c @@ -205,7 +205,7 @@ static bool load_validator(private_systime_fix_plugin_t *this) struct tm tm = { .tm_mday = 1, }; - char *str, *fmt; + char *str, *fmt, buf[32]; fmt = lib->settings->get_str(lib->settings, "%s.plugins.%s.threshold_format", "%Y", lib->ns, get_name(this)); @@ -235,7 +235,8 @@ static bool load_validator(private_systime_fix_plugin_t *this) return FALSE; } - DBG1(DBG_CFG, "enabling %s, threshold: %s", get_name(this), asctime(&tm)); + DBG1(DBG_CFG, "enabling %s, threshold: %s", get_name(this), + asctime_r(&tm, buf)); this->validator = systime_fix_validator_create(this->threshold); return TRUE; }