Bugtraq mailing list archives

Re: StackGuard with ... Re: [Paper] Format bugs.


From: "Greg A. Woods" <woods () weird com>
Date: Mon, 24 Jul 2000 14:31:45 -0400

[ On Monday, July 24, 2000 at 13:16:32 (+0300), Valentin Nechayev wrote: ]
Subject: Re: StackGuard with ... Re: [Paper] Format bugs.

It is IMHO really needed to include something similar to GCC's
__attribute((format(*printf))) to C standard. All another aspects can be
handled with exiting features.

That only helps if you can somehow force the programmer to always
hard-code the format string at compile time.  Currently this is
impossible (I suppose the "format" attribute could do this), and indeed
undesirable to many no doubt too!

A true fix requires something that would change the language definition
in a more fundamental way.  I think the best idea would be to revise the
calling conventions used for functions with variable numbers of
arguments (or perhaps all functions) and defining a new varargs/stdards
API (complete with error handling) that can be made a part of the
language definition such that a function can discern, at run time, the
number of, and type of, parameters it was called with.  (Optionally the
compiler could include code that verified the arguments of all functions
at runtime too!)

However as Theo says, that's never [or not likely] going to happen, at
least not for the language commonly called `C'.
It's already too late for C9X, I think; and it obviously means yet
another invention is added to a language that was already pretty well
standardardised in 1980 execpt for the fact that some people refused to
honour its inventor's ideas faithfully.

--
                                                        Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods () acm org>      <robohack!woods>
Planix, Inc. <woods () planix com>; Secrets of the Weird <woods () weird com>


Current thread: