|C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? psheer@WITHOUTicon.co.za (Paul Sheer) (2004-09-07)|
|Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? firstname.lastname@example.org (Christian Bau) (2004-09-08)|
|Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? email@example.com (Ken Rose) (2004-09-13)|
|Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? firstname.lastname@example.org (John R. Strohm) (2004-09-13)|
|Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? email@example.com (2004-09-14)|
|From:||Christian Bau <firstname.lastname@example.org>|
|Date:||8 Sep 2004 12:04:58 -0400|
|Posted-Date:||08 Sep 2004 12:04:58 EDT|
"Paul Sheer" <psheer@WITHOUTicon.co.za> wrote:
> I need to automatically search and replace all fixed size
> buffer strcpy's with strncpy's (or better yet, strlcpy's)
> as a security and stability audit. The code base is large
> and it is not feasable to manually perform these changes.
1. Replacing strcpy with strncpy is a very bad idea. Where strcpy
overwrites memory, strncpy will create char arrays that are not C
2. If you perform these changes automatically using some tool then
security will go _down_. Of course, if your intention is only to make
management happy and have a check on a checklist, fine. If you want your
software to be secure and stable, do it by hand.
My recommendation: Take the whole source code. Give it to two separate
programmers. Let them discuss very carefully between them how to make
changes. Then each one goes ahead and makes the necessary changes. When
they are done, you compare the results and clean up any differences.
This is the fastest and safest method to actually get a safer and more
Return to the
Search the comp.compilers archives again.