The wrong way to determine the size of a buffer
January 21st, 2010. Published under My Recent Reads. No Comments.
pulled from Google Reader (click on title for original post)
A colleague of mine showed me some code from a back-end
program on a web server.
Fortunately, the company that wrote this is out of business.
Or at least I hope they’re out of business!
size = 16384;
while (size && IsBadReadPtr(buffer, size)) {
size--;
}