|
|||||||||||
|
RE: Are bad developer libraries the problem with M$ software?
From: Michael Howard <mikehow(at)microsoft.com>
Date: Mon Nov 18 2002 - 15:51:03 EST
Cheers, Michael
-----Original Message-----
> As a side note, proper use of snprintf would be:
I believe you mean strlen and not sizeof. sizeof(mystr) will return the same as sizeof(char*), which is sizeof(int) in most cases or 4 on 32-bit platforms. Unless there's something I wasn't aware of: you're using a bizarre compiler, or C++, or there's a special case for char arrays on the stack. > Perhaps we should start development of a standardized 'safe' header
These are good ideas, and you should expand them to handle the case where the destination string is not \0-terminated. Example: strncpy. The strncpy() function copies not more than len characters from src into dst, appending `\0' characters if src is less than len characters long,
and not terminating dst otherwise.
This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT |
||||||||||
|
|||||||||||