scripts
scripts copied to clipboard
emoji_aliases.py 1.0.2: broken replacement mechanism produces invalid IRC protocol messages
emoji.lua script provides the same functionality but is free of the issues described here and is thus recommended instead of this script.
Incoming line like (hypothetical)
:nick!user@123:101:ffff QUIT :my quit message
is replaced with
:nick!user@123💯 ffff QUIT :my quit message
which causes the ffff part of the host to be in IRC command's position instead of the QUIT.
This causes errors like
irc: command "ffff" not found
There are numerous problems in the script:
- Splitting on
:blindly attempts to find the prefix (:my quit message) of the IRC message but:may appear in varying counts before that as seen with IPv6 hosts. In fact the entire existing split process is incorrect in this case because the splitting only excludes the initial:of the prefix. Correct IRC message parsing should be only done withirc_message_parseto ensure correctness. - Space is added by replacement string causing it to incorrectly split into multiple IRC protocol arguments. If the space would not be added, the IRC message would still be (possibly) valid although contain emoji in the host (
nick!user@123💯ffff). aliases_foundattempts to only aliases found in the relevant parts of the IRC message but later they are still replaced on the entirestring. This means that even if problem 1 was fixed and the parsing would be right foraliases_found, the script could misbehave the same way. This can happen when the alias found in the message also exists earlier in the IRC message (e.g. the host) and thus is actually replaced there and not in the originally found position foraliases_found.