diff --git a/server-src/amidxtaped.pl b/server-src/amidxtaped.pl
index 79ea978..5a4106e 100644
--- a/server-src/amidxtaped.pl
+++ b/server-src/amidxtaped.pl
@@ -890,7 +890,8 @@ sub getline {
last if $c eq "\n";
}
- my $chopped = $line;
+ $line =~ /^(.*)$/;
+ my $chopped = $1;
$chopped =~ s/[\r\n]*$//g;
debug("CTL << $chopped");
@@ -914,8 +915,8 @@ sub getline_async {
return $async_read_cb->($err, undef) if $err;
$buf .= $data;
- if ($buf =~ /\r\n$/) {
- my $chopped = $buf;
+ if ($buf =~ /^(.*\r\n)$/) {
+ my $chopped = $1;
$chopped =~ s/[\r\n]*$//g;
debug("CTL << $chopped");
@@ -951,8 +952,8 @@ sub sendctlline {
my $self = shift;
my ($msg, $async_write_cb) = @_;
- my $chopped = $msg;
- $chopped =~ s/[\r\n]*$//g;
+ $msg =~ /^(.*)$/;
+ my $chopped = $1;
if ($self->{'ctl_stream'}) {
debug("CTL >> $chopped");