Better handle various ctime() calls failing

This commit is contained in:
Patrick Griffis 2021-03-03 15:39:02 -06:00
parent 87eb728147
commit 964ae72fa8
2 changed files with 8 additions and 4 deletions

View File

@ -815,7 +815,9 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
if (!sess)
sess = serv->server_session;
if (tim != NULL)
tim[24] = 0; /* get rid of the \n */
EMIT_SIGNAL_TIMESTAMP (XP_TE_TOPICDATE, sess, chan, nick, tim, NULL, 0,
tags_data->timestamp);
}
@ -1489,7 +1491,7 @@ inbound_banlist (session *sess, time_t stamp, char *chan, char *mask,
server *serv = sess->server;
char *nl;
if (stamp <= 0)
if (stamp <= 0 || time_str == NULL)
{
time_str = "";
}

View File

@ -454,6 +454,7 @@ channel_date (session *sess, char *chan, char *timestr,
{
time_t timestamp = (time_t) atol (timestr);
char *tim = ctime (&timestamp);
if (tim != NULL)
tim[24] = 0; /* get rid of the \n */
EMIT_SIGNAL_TIMESTAMP (XP_TE_CHANDATE, sess, chan, tim, NULL, NULL, 0,
tags_data->timestamp);
@ -602,6 +603,7 @@ process_numeric (session * sess, int n,
else
{
tim = ctime (&timestamp);
if (tim != NULL)
tim[19] = 0; /* get rid of the \n */
EMIT_SIGNAL_TIMESTAMP (XP_TE_WHOIS4T, whois_sess, word[4],
outbuf, tim, NULL, 0, tags_data->timestamp);