|
Secure Programming
RE: Are bad developer libraries the problem with M$ software? Nov 16 2002 01:00AM Michael Howard (mikehow microsoft com) (2 replies) RE: Are bad developer libraries the problem with M$ software? Nov 16 2002 07:03PM Frank Knobbe (fknobbe knobbeits com) (3 replies) Re: Are bad developer libraries the problem with M$ software? Nov 18 2002 06:54PM John Viega (viega securesoftware com) (2 replies) Re: Are bad developer libraries the problem with M$ software? Nov 18 2002 09:46PM Frank Knobbe (fknobbe knobbeits com) (1 replies) Re: Are bad developer libraries the problem with M$ software? Nov 19 2002 09:31AM Steffen Dettmer (steffen dett de) (1 replies) Re: Are bad developer libraries the problem with M$ software? Nov 22 2002 03:35PM Tim van Erven (tripudium chello nl) Re: Are bad developer libraries the problem with M$ software? Nov 18 2002 06:26PM Götz Babin-Ebell (babinebell trustcenter de) Re: Are bad developer libraries the problem with M$ software? Nov 16 2002 03:29PM Alex Lambert (alambert webmaster com) (1 replies) Re: Are bad developer libraries the problem with M$ software? Nov 17 2002 01:46AM Glynn Clements (glynn clements virgin net) |
|
|
Privacy Statement |
>As a side note, proper use of snprintf would be:
>ret = snprintf(mystr,sizeof(mystr)-1,"Format: %s",var);
No it would not; the proper 2nd argument is the size of whatever
"mystr" points to; for char[] that's sizeof (mystr) (NOT -1) but
for char * it's whatever size you alloc'ed.
>Perhaps we should start development of a standardized 'safe' header file
>that can contain macros for snprintf, strncat and the like.
>
>Example:
>#define safe_snprinf(dst,len,fmt,var)
> snprintf(dst,(len>sizeof(dst)-1)?sizeof(dst)-1:len,fmt,var)
I remember a bug in sendmail caused by bad use of sizef.
>#define safe_strcat(dst,src) =20
> strncat(dst,src,sizeof(dst))
Same problem; not safe anyway. (sizeof (dst) - strlen(dst) - 1, if anything)
Casper
[ reply ]