This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: use of %n in genmodes.c causes trouble on Vista


Danny Smith wrote:

Unless I'missing soemthing, this is 'just' a build issue in genmode.c.
GCC builds fine for Vista target on WindowsXP. So the fix needs to be build dependent, not host dependent.

Well if a clean fix can be found that simply avoids the use of %n, then that's target independent and clean. I think that makes sense. The idea that %n is a security risk is not some Microsoft-only invention, and it is not unlikely that other environments will implement a similar check.

In case you have not seen it, this is the bit of code we are talking about :-


http://git.infradead.org/?p=gcc.git;a=blob;f=gcc/genmodes.c;h=8e71a123edb46166a16971bbf1862c2a0cfcf1b9;hb=master#l788

I think a sprintf followed by a strlen and printf is _guarenteed_ to be much more portable than printf's return value. The overhead of the strlen is minimal.

A simple fix that works on all platforms is all that is required.

Aaron



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]