> -----Original Message----- > > I think it would be better to teach strlcpy to zero-pad as well. > > I'd rather we created new functions with new names that add the non-portable > zeroing behaviour -- perhaps strlpcpy() and strnpcpy(), or something equally > incomprehensible. This semantic may actually trigger bugs in code that is > correct (albeit badly written) using strncpy() and strlcpy() in a way that > never fully > fills the buffer (due to some external invariant) and has an incorrect bounds > check -- and potentially trigger performance problems when target buffers are > much larger than the copied data. > > Robert > _______________________________________________
Robert is right - this is not a good idea to rely on a non-standard "smart" behavior of basic functions. If the developer wants to code it "securely", he/she always can use his own wrappers around the strncpy() etc. Any inherent built-in behavior that is not "standard" is affecting future maintenance of the code. Oleg _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"