]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Better handle various ctime() calls failing
authorPatrick Griffis <redacted>
Wed, 3 Mar 2021 21:39:02 +0000 (15:39 -0600)
committerPatrick Griffis <redacted>
Wed, 3 Mar 2021 21:39:02 +0000 (15:39 -0600)
src/common/inbound.c
src/common/proto-irc.c

index 7ac3c71a49543b352fd8645b206296db60dc9431..71c60357fb529269e01dc94fe055f8c3f6583e87 100644 (file)
@@ -815,7 +815,9 @@ inbound_topictime (server *serv, char *chan, char *nick, time_t stamp,
        if (!sess)
                sess = serv->server_session;
 
-       tim[24] = 0;    /* get rid of the \n */
+       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 = "";
        }
index 69501ee3b65cdd6ea32f160dd15cac61f7c72d7d..fa2d822b86783ab203bd40ae4c196199f1f25978 100644 (file)
@@ -454,7 +454,8 @@ channel_date (session *sess, char *chan, char *timestr,
 {
        time_t timestamp = (time_t) atol (timestr);
        char *tim = ctime (&timestamp);
-       tim[24] = 0;    /* get rid of the \n */
+       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,7 +603,8 @@ process_numeric (session * sess, int n,
                        else
                        {
                                tim = ctime (&timestamp);
-                               tim[19] = 0;    /* get rid of the \n */
+                               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);
                        }