Sujet : Re: A Famous Security Bug
De : ram (at) *nospam* zedat.fu-berlin.de (Stefan Ram)
Groupes : comp.lang.cDate : 27. Mar 2024, 11:35:27
Autres entêtes
Organisation : Stefan Ram
Message-ID : <0-20240327113225@ram.dialup.fu-berlin.de>
References : 1 2
ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
void f()
{ char buffer[MAX];
/* . . . */
memset( buffer, 0, sizeof( buffer ));
Ensures( buffer[ 0 ]== 0 ); }
Oh, and now I see a potential bug in this:
"buffer[ 0 ]" assumes that MAX > 0.
(ISO C forbids "char buffer[ 0 ];", but the code
might be used on some nonstandard implementation.)