buffer overflow

Trent Shipley plug-devel@lists.PLUG.phoenix.az.us
Wed Aug 22 12:54:01 2001


In short, work in C and C++ only when no other language will suit.  
Otherwise use Ada.  :)

> Code written to protect these situations are an important programming
> practice for security and just for good reasons such as not writing to
> memory you don't "own."
> 
> Putting restrictions on the above program such as:
> 
> #include <stdio.h>
> 
> int main( int argc, char * argv[] )
> {
>   char a = 'a';
>   char cName[5];
>   int  i = 0;
> 
>   /* Now written to protect against array overflow */
> 
>   do
>   {
>     cName[i] = a++;
>     printf( "%c", cName[i++] );
>   }   
>   while( i < ( sizeof( cName ) / sizeof( char ) ) );
> 
>   printf( "\n" );
> 
>   return 0;
> }
> 
> 
> > 
> > Thanks
> > 
> 
> No problemo...
> 
> Take Care.
> 
> Rob!
> _______________________________________________
> PLUG-devel mailing list  -  PLUG-devel@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel