mirror of
https://github.com/clearml/dropbear
synced 2025-01-31 10:57:01 +00:00
Fix potential null pointer dereference found by Klokwork
--HG-- extra : convert_revision : ef7030b29eca0944e6fbbdcdd776aafe39197ffa
This commit is contained in:
parent
85f22c9f09
commit
28f1026de8
@ -181,10 +181,15 @@ void svr_dropbear_log(int priority, const char* format, va_list param) {
|
||||
|
||||
if (!svr_opts.usingsyslog || havetrace)
|
||||
{
|
||||
struct tm * local_tm = NULL;
|
||||
timesec = time(NULL);
|
||||
if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
|
||||
localtime(×ec)) == 0) {
|
||||
datestr[0] = '?'; datestr[1] = '\0';
|
||||
local_tm = localtime(×ec);
|
||||
if (local_tm == NULL
|
||||
|| strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
|
||||
localtime(×ec)) == 0)
|
||||
{
|
||||
// upon failure, just print the epoch-seconds time.
|
||||
snprintf(datestr, sizeof(datestr), "%d", timesec);
|
||||
}
|
||||
fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user