This is the mail archive of the gcc-patches@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]

Re: GCC extension for protecting applications from format string attacks


On Thu, Apr 05, 2001 at 12:57:27PM -0700, Zack Weinberg wrote:
> Aaargh.

Yeah.  Anyway, just counting the number of arguments doesn't really do
the job here.  You also have to know what type the passed arguments were.

If the target uses fp registers for fp data, and integer registers for
pointer data, or data registers for integer data and address registers
or pointer data, or ....  Then you can still feed uninitialized values
to printf by having a type mismatch between the format string and the
actual parameters.  Multiple sets of counts don't do the job because the
calling convention might leave holes in the registers that it uses.

The only solution is an array of data as by __builtin_classify_type for
each passed parameter.


r~


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