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:
It doesn't do what you would expect it to do, right?#!/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"; }
Of course, I may be dead wrong ....
In reply to Re^2: Read a list of NUL-delimited names from STDIN to be processed
by Ultra
in thread Read a list of NUL-delimited names from STDIN to be processed
by merlyn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |