• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSString, stringByAppendingPathComponent, and Canonicalization
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSString, stringByAppendingPathComponent, and Canonicalization


  • Subject: NSString, stringByAppendingPathComponent, and Canonicalization
  • From: Jeffrey Walton <email@hidden>
  • Date: Mon, 04 Apr 2011 23:08:01 -0400

Hi All,

I need to accept a filename from the user. Given the user supplied
filename, I form a fully qualified name:

NSString* pathName = [NSHomeDirectory(),
stringByAppendingPathComponent:@"Documents"];
NSString* fullPathName = [pathName  stringByAppendingPathComponent:filename];

How do I canonicalize the the resulting fullPathName to verify there
was no directory traversal goodness in the filename? In case its
relevant, the platform is iOS.

Jeff
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSString, stringByAppendingPathComponent, and Canonicalization
      • From: David Duncan <email@hidden>
    • Re: NSString, stringByAppendingPathComponent, and Canonicalization
      • From: Ken Thomases <email@hidden>
    • Re: NSString, stringByAppendingPathComponent, and Canonicalization
      • From: "Stephen J. Butler" <email@hidden>
  • Prev by Date: Re: Trying to subclass UISwitch
  • Next by Date: Re: NSString, stringByAppendingPathComponent, and Canonicalization
  • Previous by thread: Re: Programming Context Menu
  • Next by thread: Re: NSString, stringByAppendingPathComponent, and Canonicalization
  • Index(es):
    • Date
    • Thread