|
|||||||||||
|
Re: Are bad developer libraries the problem with M$ software?
From: Andrew Dalgleish <secprog(at)andrewdalgleish.dyndns.org>
Date: Tue Nov 19 2002 - 17:57:57 EST
On Mon, Nov 18, 2002 at 09:25:46PM -0600, Frank Knobbe wrote:
No, it would not. strncpy does NOT append the trailing 0 if the length of the source is greater than or equal to the count. Using sizeof(dst)-1 will leave the last byte in the buffer unchanged. If dst is on the stack there is no guarantee the string is terminated. To be sure, you would *also* need to add dst[sizeof(dst)-1] = 0; C'mon people, this really is beginner stuff. Please RTFM before you post well-meaning advice. You might also like to look at the bsd-style strlcpy/strlcat functions. Received on Fri Nov 22 01:45:47 2002 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:02:44 EDT |
||||||||||
|
|||||||||||