This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #117265] safesyscalls: check embedded nul in syscall args
authorTony Cook <tony@develop-help.com>
Mon, 26 Aug 2013 01:26:19 +0000 (11:26 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 26 Aug 2013 04:06:16 +0000 (14:06 +1000)
commitc8028aa68dedb3c7683abb0bcf0fdba782a1190e
tree0c1acb4263f2d3d1b08e2e42d1ad18b2686617d8
parent5f7c1602dfa694a4a6761e9e4fc077ce794f7ff0
[perl #117265] safesyscalls: check embedded nul in syscall args

Check for the nul char in pathnames and string arguments to
syscalls, return undef and set errno to ENOENT.
Added to the io warnings category syscalls.

Strings with embedded \0 chars were prev. ignored in the syscall but
kept in perl. The hidden payloads in these invalid string args may cause
unnoticed security problems, as they are hard to detect, ignored by
the syscalls but kept around in perl PVs.
Allow an ending \0 though, as several modules add a \0 to
such strings without adjusting the length.

This is based on a change originally by Reini Urban, but pretty much
all of the code has been replaced.
20 files changed:
doio.c
embed.fnc
embed.h
ext/File-Glob/Glob.pm
ext/File-Glob/Glob.xs
inline.h
lib/warnings.pm
perl.h
perlio.c
pod/perldiag.pod
pod/perllexwarn.pod
pp_ctl.c
proto.h
regen/warnings.pl
t/io/open.t
t/lib/warnings/doio
t/op/caller.t
t/op/require_errors.t
t/porting/diag.t
warnings.h