Re: security coding guidelines for C/C++
From: Malcolm (malcolm_at_55bank.freeserve.co.uk)
Date: 05/24/04
- Next message: P.J. Plauger: "Re: Sine code for ANSI C"
- Previous message: P.J. Plauger: "Re: Sine code for ANSI C"
- Maybe in reply to: CBFalconer: "Re: security coding guidelines for C/C++"
- Next in thread: August Derleth: "Re: security coding guidelines for C/C++"
- Reply: August Derleth: "Re: security coding guidelines for C/C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 24 May 2004 21:00:08 +0100
"Aravind" <arvind_c_98@yahoo.com> wrote in message
>
> I am Aravind.Could someone provide me with a list of specific
> guidelines for secure programming in C/C++?.
> I would like to use those guidelines for developing a security
> application to deal with issues like buffer overflows,memory
> leaks,user input validation etc....
>
Security is a real problem for C programs, and it is not easy to write tools
to check for it.
The worst problem is when user input overflows an "auto" (stack) array, on
systems where this corrupts the reurn stack. An attacker can use this to
induce a jump to a location of his choosing, and thus introduce malicious
code.
It is also possible to oveflow the stack. For instance the code
double eval( char *expr)
{
...
if(*expr == '9')
temp = eval(expr+1);
...
}
can be caused to crash by inputting a huge number of open parentheses.
You simply have to be careful to call malloc() with the right size, not
overstep the array, check the return value, and free memory after you have
done with it. The good news is that there is little the user can do to wreck
things here. (To test, a good technique is to provide a version of malloc()
that fails periodically).
For user input, be aware that the user can type anything, and assume he is
trying to wreck your program and has a copy of the source.
- Next message: P.J. Plauger: "Re: Sine code for ANSI C"
- Previous message: P.J. Plauger: "Re: Sine code for ANSI C"
- Maybe in reply to: CBFalconer: "Re: security coding guidelines for C/C++"
- Next in thread: August Derleth: "Re: security coding guidelines for C/C++"
- Reply: August Derleth: "Re: security coding guidelines for C/C++"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|