in reply to Why do poisoned null attacks still work ?

Yes, it would be quite trivial to get Perl's open-like constructs to fail (actually die) when given a filename matching /\0./s, and that would quite simply be a "good thing" despite all of the apologists in this thread and in p5p (notably excepting ikegami -- thanks). This should also apply to the stat-like constructs, of course.

I encourage you to visit corehackers and submit your patches in that much more receptive environment (compared to p5p). This would be a very nice improvement to Perl's security vulnerabilities.

- tye        

Replies are listed 'Best First'.
Re^2: Why do poisoned null attacks still work ? (sanity)
by moritz (Cardinal) on Jul 26, 2009 at 19:15 UTC
    I'm curious - wouldn't that prevent you from opening files with UTF-16 encoded names under windows? Or does that use an entirely different API?

    If that's not a problem, I'm all for making it fatal.

      Perl's open can't be used for opening UTF-16-encoded filenames under Windows. To be clear, all filenames are encoded in UTF-16 under the covers in Windows, but the string (of bytes) passed to Perl's open is (eventually) interpretted as a string of 8-bit characters in the current "code page". Passing a UTF-16 string to Perl's open would result in a file with a one-byte name being opened (until this crazy behavior is fixed, at which point it would die).

      In some future version of Perl, it would be nice if open (and lots of other things) could handle out-of-current-code-page characters in filenames (on Win32). That would surely be provided by allowing a Perl-Unicode string to be used as a filename. Internally, perl would notice the "is UTF-8" bit on the string and then translate that string into UTF-16 and then call the alternate underlying API that expects UTF-16 strings. I've actually written code that does this as updates to Win32API::File that I really need to finish merging and testing. /:

      - tye        

      open uses the 8-bit ("A") API. It can't open files with names with wide characters. If it could, you'd probably pass it as a Perl string and it would encode it to UCS-2le for you, so there would be no problem.

Re^2: Why do poisoned null attacks still work ? (sanity)
by Anonymous Monk on Jul 25, 2009 at 16:05 UTC
    Let try to push it for 10.0.1/5.8.10
      The 5.8 branch is dead, and the 5.10 branch is in a partial code freeze in preparation for the release of 5.10.1.
        The 5.8 branch is dead

        Not dead enough for this security feature.