Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option??

Ken Rose <kenrose@tfb.com>
13 Sep 2004 10:48:33 -0400

          From comp.compilers

Related articles
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?? christian.bau@cbau.freeserve.co.uk (Christian Bau) (2004-09-08)
Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? kenrose@tfb.com (Ken Rose) (2004-09-13)
Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? strohm@airmail.net (John R. Strohm) (2004-09-13)
Re: C++ Compiler with a -Wwarn-use-of-strcpy or similar option?? psheer@icon.co.za (2004-09-14)
| List of all articles for this month |

From: Ken Rose <kenrose@tfb.com>
Newsgroups: comp.compilers,comp.lang.c++
Date: 13 Sep 2004 10:48:33 -0400
Organization: Posted via Supernews, http://www.supernews.com
References: 04-09-038
Keywords: tools, GCC
Posted-Date: 13 Sep 2004 10:48:33 EDT

Paul Sheer 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.


> Can GCC be modified to give such a warning?


GCC has a way to "poison" an identifier. I'm not finding it in a
quick perusal of the info pages, but I remember encountering it when
upgrading a port from gcc2 to gcc3.


It produces an error, not a warning, when the code attempts to use the
poisoned identifier.


Ahhh. Here it is (grepping the source)


#pragma GCC poison <ident>


Actually, it looks like it's just in g++.


Good luck - sorry about the incoherent post.


    - ken


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.