and I don't chomp the data as the extra nul byte doesn't hurt after filenames.
Well I think it could hurt in case of a Null Byte Poisoning
Let's say you would have a null terminated file name, and would like to append the name with another string (like an index or whatever)
Consider the following piece of code:
#!/usr/bin/perl -w
use strict;
my $fname = "aaa.txt\0bla";
print "NAME: $fname\n";
if ( $fname =~ /\0/ ) {
open( F, ">$fname" ) || die "could not open $fname, reason: $!";
close(F);
}
else {
print "No NULL BYTE in $fname\n";
}
It doesn't do what you would expect it to do, right?
Of course, I may be dead wrong ....
|