mirror of
https://github.com/clearml/dropbear
synced 2025-02-07 13:21:15 +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)
|
if (!svr_opts.usingsyslog || havetrace)
|
||||||
{
|
{
|
||||||
|
struct tm * local_tm = NULL;
|
||||||
timesec = time(NULL);
|
timesec = time(NULL);
|
||||||
if (strftime(datestr, sizeof(datestr), "%b %d %H:%M:%S",
|
local_tm = localtime(×ec);
|
||||||
localtime(×ec)) == 0) {
|
if (local_tm == NULL
|
||||||
datestr[0] = '?'; datestr[1] = '\0';
|
|| 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);
|
fprintf(stderr, "[%d] %s %s\n", getpid(), datestr, printbuf);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user