From: Aaron Crane Date: Sat, 24 Mar 2012 11:27:08 +0000 (+0000) Subject: Defend against potential token-pasting bug X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Fno-token-pasting;p=scpubgit%2FTak.git Defend against potential token-pasting bug Ensure that concatenating "__END__" onto the script behaves correctly even if $Tak::STDIONode::DATA happens to end in a \w character. It's not clear to me whether that's actually possible in practice, but defensively adding extra whitespace seems like a good idea nonetheless. --- diff --git a/lib/Tak/ConnectorService.pm b/lib/Tak/ConnectorService.pm index 3fde0f0..90333bc 100644 --- a/lib/Tak/ConnectorService.pm +++ b/lib/Tak/ConnectorService.pm @@ -23,7 +23,7 @@ sub handle_create { my $log_level = $args{log_level}||'info'; my ($kid_in, $kid_out, $kid_pid) = $self->_open($on, $log_level); if ($kid_pid) { - $kid_in->print($Tak::STDIONode::DATA, "__END__\n") unless $on eq '-'; + $kid_in->print($Tak::STDIONode::DATA, "\n__END__\n") unless $on eq '-'; # Need to get a handshake to indicate STDIOSetup has finished # messing around with file descriptors, otherwise we can severely # confuse things by sending before the dup.