Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 22ad1c705beb8b32c7533a95c1db82e006d4b39b
Ticket: 3118489fffffffffffffffffffffffffffffffff
NUL in filenames
User & Date: andygoth on 2010-11-25 14:51:20
Changes

  1. assignee changed to: "vincentdarley"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    Some file commands treat NUL (\0) as a string terminator.  Others treat it as a normal character.  This inconsistency makes it possible to spoof commands that filter based on filename, particularly extension.  Example:
    
    proc access {name} {
        if {[file extension $name] eq ".secret"} {
            error denied
        } else {
            puts granted
            open $name
        }
    }
    % access file.secret
    denied
    % access file.secret\0
    granted
    file5
    
    Generally, it's the commands that talk to the operating system that treat NUL as the string terminator.  (More likely it's the operating system itself that does this!)  For example, [open] and [cd] do this:
    
    % cd .
    % cd .\0
    % cd \0.
    couldn't change working directory to "NUL.": no such file or directory
    # (in the previous line, NUL is a real NUL character; to see it, use tkcon instead of xterm)
    % file exists .
    1
    % file exists .\0
    1
    % file exists \0.
    0
    
  4. foundin changed to: "obsolete: 8.6b1.1"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "andygoth"
  10. subsystem changed to: "37. File System"
  11. title changed to: "NUL in filenames"
  12. type changed to: "Bug"