NSString, stringByAppendingPathComponent, and Canonicalization
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