First, I wouldn't initialize the buffer with nuls. I'd initialize it with (for example) exclamation points, with perhaps a nul at the end. That way if a wayward pointer gives us a string of exclamation points, we'll have a better chance of recognizing the problem. A string of nuls is neither distinctive nor informative.
I agree. A long time ago I used to use a debugging malloc library that filled the buffers returned with '\001' bytes. It's amazing how many bugs one finds that way.
- David -- David J. Fiander Digital Services Librarian