On 04/10/2009, at 11:07 PM, Squ Aire wrote:

But that isn't good enough really, because a file can have the pdf extension without being a true PDF file.


This is true, but how far are you prepared to go? Others have suggested checking a few bytes into the file's header which should be reasonable enough, but I could create a file having a valid PDF header and garbage thereafter... you cannot protect yourself against that sort of thing, so the question is where your code would draw the line. Most people would draw it with a simple check of the extension and maybe for files that traditionally have been subject to extension abuse (I don't think pdf is one of them), a few header bytes.

What is it you're afraid of?

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to