sopel-irc / sopel

:robot::speech_balloon: An easy-to-use and highly extensible IRC Bot framework. Formerly Willie.
https://sopel.chat
Other
951 stars 405 forks source link

NUL (`\x00`) is not filtered from IRC args/text #2566

Open dgw opened 7 months ago

dgw commented 7 months ago

Requested Feature

irc.utils.safe() strips CR and LF from its input, but not NUL (\x00) even though all three octets are disallowed in IRC lines.

https://github.com/sopel-irc/sopel/blob/3ff58c160ecc7a9d51f1e06426d456c7db4d985a/sopel/irc/utils.py#L20-L48

Problems Solved

Plugins accidentally sending NUL will most likely cause the server to disconnect the bot with an error ("malformed data" or similar).

Alternatives

Plugin authors must manually ensure that anything their code sends to IRC does not contain the NUL byte.

Notes

No response