Skip to content

Commit

Permalink
Fix for an error that occurred if only '+OK ' was sent by a client.
Browse files Browse the repository at this point in the history
  • Loading branch information
phyber committed Nov 5, 2008
1 parent 90b07ab commit dbe07da
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions fish.pl
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,17 @@ sub save_keys {
sub msg_decrypt {
my ($tag, $chan, $text, $key) = @_;

if (defined $key and index($text, '+OK') == 0) {
if (defined $key and index($text, '+OK ') == 0) {
$blowfish->set_key($key);
my $text = ( split(/\+OK /, $text) )[1];
return $blowfish->decrypt($text);
# Check that text actually exists, it's possible that someone might just send '+OK ' and no text.
if ($text) {
return $blowfish->decrypt($text);
}
else {
# If there was no text, return an empty line.
return "";
}
}
else {
# Check if we want to mark unencrypted text or not.
Expand Down

0 comments on commit dbe07da

Please sign in to comment.