Skip to content

Comment on C++ Software Security Sins: Basic Issuesparent

Comments

I've seen that in professional decently built code. In the code that I am thinking of though, instead of 26, it is MAX_PATH, which is 260 and is used to specify the maximum length of a filepath. It is used to interface with specific Microsoft functions that handle file paths by taking in an array of chars and immediately after is converted to a std::string. Sure, it could be dynamically allocated, but if it gets a filepath longer than the maximum length of a filepath, then it is already dealing with some sort of undefined behavior.

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.