
30 Jan
2006
30 Jan
'06
9:54 a.m.
Reece Dunn wrote:
Normally, in C (or even some C++ code), you have constructs that look like this:
char buffer[ 15 ]; sprintf( buffer, "Some %s text", "verly long" );
No self-respecting coding standard would allow you to write the code above. Rather it would insist that at least you wrote: snprintf( buffer, 15, "Some %s text", "verly long" ); Does that not solve the problem of overruns? Jim