]> jfr.im git - irc/hexchat/hexchat.git/commitdiff
Remove : from various trailing parameters (#2301)
authorlinuxdaemon <redacted>
Thu, 31 Jan 2019 00:46:13 +0000 (18:46 -0600)
committerPatrick Griffis <redacted>
Sat, 21 Dec 2019 06:26:28 +0000 (22:26 -0800)
Partial fix for #2271

This isn't an exhaustive list, but it's everything I could find. The bug still exists in the parser though, this is just a workaround for the moment

src/common/modes.c
src/common/proto-irc.c
src/common/proto-irc.h

index c65bf279650eb3ebdcdd2590637de31be2a38572..3c0ac8abcfdbec19271458a0d459ced25e9467c3 100644 (file)
@@ -735,6 +735,8 @@ handle_mode (server * serv, char *word[], char *word_eol[],
                if (!(*word[i + offset]))
                        break;
                num_args++;
+               if (word[i + offset][0] == ':')
+                       break;
        }
 
        /* count the number of modes (without the -/+ chars */
@@ -765,7 +767,7 @@ handle_mode (server * serv, char *word[], char *word_eol[],
                        if ((all_modes_have_args || mode_has_arg (serv, sign, *modes)) && arg < (num_args + 1))
                        {
                                arg++;
-                               argstr = word[arg + offset];
+                               argstr = STRIP_COLON(word, word_eol, arg+offset);
                        }
                        handle_single_mode (&mr, sign, *modes, nick, chan,
                                                                          argstr, numeric_324 || prefs.hex_irc_raw_modes,
index 776d14342611854979ba129f59097c9e87eb1ac3..497cb6cac89d9befe50d1c704c0cb8254d21b18c 100644 (file)
@@ -714,7 +714,7 @@ process_numeric (session * sess, int n,
                break;
 
        case 333:
-               inbound_topictime (serv, word[4], word[5], atol (word[6]), tags_data);
+               inbound_topictime (serv, word[4], word[5], atol (STRIP_COLON(word, word_eol, 6)), tags_data);
                break;
 
 #if 0
@@ -726,7 +726,7 @@ process_numeric (session * sess, int n,
 #endif
 
        case 341:                                                 /* INVITE ACK */
-               EMIT_SIGNAL_TIMESTAMP (XP_TE_UINVITE, sess, word[4], word[5],
+               EMIT_SIGNAL_TIMESTAMP (XP_TE_UINVITE, sess, word[4], STRIP_COLON(word, word_eol, 5),
                                                                          serv->servername, NULL, 0, tags_data->timestamp);
                break;
 
@@ -1142,7 +1142,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
                {
 
                case WORDL('A','C','C','O'):
-                       inbound_account (serv, nick, word[3], tags_data);
+                       inbound_account (serv, nick, STRIP_COLON(word, word_eol, 3), tags_data);
                        return;
 
                case WORDL('A', 'U', 'T', 'H'):
@@ -1150,7 +1150,7 @@ process_named_msg (session *sess, char *type, char *word[], char *word_eol[],
                        return;
 
                case WORDL('C', 'H', 'G', 'H'):
-                       inbound_user_info (sess, NULL, word[3], word[4], NULL, nick, NULL,
+                       inbound_user_info (sess, NULL, word[3], STRIP_COLON(word, word_eol, 4), NULL, nick, NULL,
                                                           NULL, 0xff, tags_data);
                        return;
 
index a7b4029c50c772243d12aca7bbbcf4da96754fe8..6c07579598a197518d7437ce0cdc882d85a41b05 100644 (file)
@@ -28,6 +28,8 @@
                (time_t)0, /* timestamp */              \
        }
 
+#define STRIP_COLON(word, word_eol, idx) (word)[(idx)][0] == ':' ? (word_eol)[(idx)]+1 : (word)[(idx)]
+
 /* Message tag information that might be passed along with a server message
  *
  * See http://ircv3.atheme.org/specification/capability-negotiation-3.1