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