diff options
author | Jarkko Hietaniemi <jhi@iki.fi> | 2000-03-19 01:48:47 +0000 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2000-03-19 01:48:47 +0000 |
commit | d929ce6fe8f415355968ae904607a49f36ad5c70 (patch) | |
tree | 55c5af0a110b532106f3395cc36541ef70d8358f /t/op/taint.t | |
parent | 2959b6e3384ea619841b1f9556846dd2755caf04 (diff) | |
download | perl-d929ce6fe8f415355968ae904607a49f36ad5c70.tar.gz |
Taint shmread().
p4raw-id: //depot/cfgperl@5811
Diffstat (limited to 't/op/taint.t')
-rwxr-xr-x | t/op/taint.t | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/t/op/taint.t b/t/op/taint.t index 883f069dbd..51dcbd8e5b 100755 --- a/t/op/taint.t +++ b/t/op/taint.t @@ -94,7 +94,7 @@ print PROG 'print "@ARGV\n"', "\n"; close PROG; my $echo = "$Invoke_Perl $ECHO"; -print "1..149\n"; +print "1..150\n"; # First, let's make sure that Perl is checking the dangerous # environment variables. Maybe they aren't set yet, so we'll @@ -605,3 +605,36 @@ else { $why =~ s/e/'-'.$$/ge; test 149, tainted $why; } + +# test shmread +{ + if ($Config{d_shm}) { + use IPC::SysV qw(IPC_PRIVATE IPC_RMID S_IRWXU S_IRWXG S_IRWXO); + + my $sent = "foobar"; + my $rcvd; + my $size = 2000; + my $key = shmget(IPC_PRIVATE, $size, S_IRWXU|S_IRWXG|S_IRWXO) || + warn "# shmget failed: $!\n"; + if ($key >= 0) { + if (shmwrite($key, $sent, 0, 60)) { + if (shmread($key, $rcvd, 0, 60)) { + substr($rcvd, index($rcvd, "\0")) = ''; + } else { + warn "# shmread failed: $!\n"; + } + } else { + warn "# shmwrite failed: $!\n"; + } + shmctl($key, IPC_RMID, 0) || warn "# shmctl failed: $!\n"; + } + + if ($rcvd eq $sent) { + test 150, tainted $rcvd; + } else { + print "ok 150 # Skipped: SysV shared memory operation failed\n"; + } + } else { + for (150) { print "ok $_ # Skipped: SysV shared memory is not available\n"; } + } +} |