diff options
author | Luke Macken <luke.macken@gmail.com> | 2010-04-05 20:57:23 +0000 |
---|---|---|
committer | Luke Macken <luke.macken@gmail.com> | 2010-04-05 20:57:23 +0000 |
commit | 18db1f2c01680a73d84c0f32d01dc1dc3cc72ec7 (patch) | |
tree | ce3b894ccacfaf54cf72d8004d561e1f80cf9d31 | |
parent | 98c4349c009df4e90d8c986ddd7a465a15f9b310 (diff) | |
download | irssi-notify-18db1f2c01680a73d84c0f32d01dc1dc3cc72ec7.tar.gz irssi-notify-18db1f2c01680a73d84c0f32d01dc1dc3cc72ec7.tar.xz irssi-notify-18db1f2c01680a73d84c0f32d01dc1dc3cc72ec7.zip |
Sanitise both $message AND $summary.
Thanks to Tom Adams for the patch.
http://github.com/holizz/irssi-libnotify/commit/545f022f5dc855feed5b46fc4d94d02ab659c3eb
git-svn-id: https://irssi-libnotify.googlecode.com/svn/trunk@33 291cbfae-0d27-0410-99d7-557b17e6fe3d
-rw-r--r-- | notify.pl | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -22,14 +22,21 @@ $VERSION = "0.01"; Irssi::settings_add_str('notify', 'notify_icon', 'gtk-dialog-info'); Irssi::settings_add_str('notify', 'notify_time', '5000'); +sub sanitize { + my ($text) = @_; + $text =~ s/&/&/g; # That could have been done better. + $text =~ s/</</g; + $text =~ s/>/>/g; + $text =~ s/'/'/g; + return $text; +} + sub notify { my ($server, $summary, $message) = @_; # Make the message entity-safe - $message =~ s/&/&/g; # That could have been done better. - $message =~ s/</</g; - $message =~ s/>/>/g; - $message =~ s/'/'/g; + $summary = sanitize($summary); + $message = sanitize($message); my $cmd = "EXEC - notify-send" . " -i " . Irssi::settings_get_str('notify_icon') . |