Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
escape null bytes as U+2400 SYMBOL FOR NULL, sorear++
  • Loading branch information
moritz committed Nov 10, 2010
1 parent cbc39d2 commit 938911b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/EvalbotExecuter.pm
Expand Up @@ -72,6 +72,7 @@ use Carp qw(confess);
use File::Temp qw(tempfile);
use Scalar::Util qw(reftype);
use Encode qw(encode);
use charnames qw(:full);

my $max_output_len = 290;

Expand All @@ -84,7 +85,9 @@ sub run {
$response = "OUTPUT«$response»";
}
my $newline = '';
my $null = "\N{SYMBOL FOR NULL}";
$response =~ s/\n/$newline/g;
$response =~ s/\x00/$null/g;
if (length $response > $max_output_len){
$response = substr $response, 0, $max_output_len - 1;
$response .= '';
Expand Down

0 comments on commit 938911b

Please sign in to comment.