Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tainted values become untainted in tied hashes #3833

Closed
p5pRT opened this issue Apr 6, 2001 · 5 comments
Closed

tainted values become untainted in tied hashes #3833

p5pRT opened this issue Apr 6, 2001 · 5 comments

Comments

@p5pRT
Copy link

p5pRT commented Apr 6, 2001

Migrated from rt.perl.org#6758 (status was 'resolved')

Searchable as RT6758$

@p5pRT
Copy link
Author

p5pRT commented Apr 6, 2001

From phanson@well.com

Using a tied hash untaints the values stored in the hash under perl 5.6.0
(both Solaris 5.6 and Windows (Active Perl). Here's an example program
that demonstrates the problem​:

  #!/usr/local/bin/perl5 -T

  package IHash ;

  sub check_tainted
  {
  my $type = shift ;
  my $value = shift ;
  my $istainted = ! eval { my $x = $value, kill 0 ; 1 } ;
  print $istainted ? "TAINTED​: " : 'not tainted​: ' ;
  print "$type = $value\n" ;
  }

  sub STORE
  {
  my $this = shift ;
  my $key = shift ;
  my $value = shift ;
  check_tainted('key', $key) ;
  check_tainted('value', $value) ;
  }

  sub TIEHASH
  {
  my $class = shift ;
  my $this = {} ;
  return bless $this => $class ;
  }

  package main ;

  my %hash ;

  tie %hash, 'IHash' ;
  my $key = shift @​ARGV ;
  my $value = shift @​ARGV ;
  IHash​::check_tainted('original key', $key) ;
  IHash​::check_tainted('original value', $value) ;

  $hash{$key} = $value ;

When run with arguments of 'arg1' and 'arg2' on the command line, it
produces the following output​:

  TAINTED​: original key = arg1
  TAINTED​: original value = arg2
  TAINTED​: key = arg1
  not tainted​: value = arg2

Perl Info

Flags:
    category=core
    severity=high

Site configuration information for perl v5.6.0:

Configured by phanson at Wed Sep  6 18:10:35 PDT 2000.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos well 5.6 generic_105181-21 sun4u sparc sunw,ultra-4 '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/BerkeleyDB/include -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    ccflags ='-I/usr/local/BerkeleyDB/include -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags ='-L/usr/local/BerkeleyDB/lib -L/usr/local/lib '
    libpth=/usr/local/BerkeleyDB/lib /usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldb -ldl -lm -lc -lcrypt -lsec
    libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl'
    cccdlflags='-fPIC', lddlflags='-W,l -G -L/usr/local/BerkeleyDB/lib -L/usr/local/lib'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr/local/lib/perl5/5.6.0/sun4-solaris
    /usr/local/lib/perl5/5.6.0
    /usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
    /usr/local/lib/perl5/site_perl/5.6.0
    /usr/local/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/home/p/h/phanson
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=.:/home/p/h/phanson/bin:/usr/local/gnu/bin:/usr/local/lib/acct:/usr/local/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:.:/opt/SUNWspro/bin:/usr/well/bin:/usr/local/sbin:/usr/local/rdb/bin:/usr/local/sysadmin/bin:/usr/local/lib/nuoracle
    PERL_BADLANG (unset)
    SHELL=/usr/bin/ksh

@p5pRT
Copy link
Author

p5pRT commented May 8, 2003

From @iabyn

still present in bleedperl@​19435

@p5pRT
Copy link
Author

p5pRT commented Mar 10, 2004

From @muir

Still present in 5.8.3

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2010

From @iabyn

This has been fixed by commit b112cff
in the branch davem/post-5.12 which should be merged back into blead
once 5.12 has been released, and thus appear in 5.14.

@p5pRT
Copy link
Author

p5pRT commented Mar 20, 2010

@iabyn - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant