Bugtraq mailing list archives
Re: StackGuard with ... Re: [Paper] Format bugs.
From: Casper Dik <Casper.Dik () HOLLAND SUN COM>
Date: Mon, 24 Jul 2000 21:50:35 +0200
The first thing to do is turn on the damn compiler warnings, because more
and more compilers actually do check printf-like parameters for you. GNU C
does this, as do numerous commercial compilers:
$ cat test.c
#include <stdio.h>
int main(void)
{
printf("i = %d\n"); <--- missing parameter!
}
And, e.g., Sun lint supports this too:
cat x.c
#include <stdio.h>
/* PRINTFLIKE1 */
extern setproctitle(const char *fmt, ...);
int main(int argc, char *argv[])
{
printf("i = %d\n");
setproctitle("%s");
setproctitle(argv[0]);
}
% lint x.c
(12) warning: Function has no return statement : main
argument unused in function
(6) argc in main
function falls off bottom without returning value
(12) main
function returns value which is always ignored
printf
too few arguments for format
printf x.c(8)
setproctitle x.c(9)
(Not setproctitle in Solaris, just an exampel of how
to declare such a function)
Of course, this shows a weakness too. Standard broken usage
such as "*printf(s)" doesnt' get flagged..
Casper
Current thread:
- Re: StackGuard with ... Re: [Paper] Format bugs., (continued)
- Re: StackGuard with ... Re: [Paper] Format bugs. Greg A. Woods (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Brett Glass (Jul 25)
- Re: StackGuard with ... Re: [Paper] Format bugs. mixter (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Linus Akesson (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Dan Harkless (Jul 25)
- Re: StackGuard with ... Re: [Paper] Format bugs. Valentin Nechayev (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Greg A. Woods (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Dick St.Peters (Jul 25)
- Re: StackGuard with ... Re: [Paper] Format bugs. Hannah Schröter (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Stephen J. Friedl (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Casper Dik (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. stanislav shalunov (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Daniel Jacobowitz (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Alan DeKok (Jul 22)
- Re: StackGuard with ... Re: [Paper] Format bugs. Keith Owens (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Greg A. Woods (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Gerardo Richarte (Jul 24)
- Re: StackGuard with ... Re: [Paper] Format bugs. Greg A. Woods (Jul 25)
- Re: StackGuard with ... Re: [Paper] Format bugs. Theo de Raadt (Jul 24)
- Chasing bugs / vulnerabilties Michael S Hines (Jul 24)
- Re: Chasing bugs / vulnerabilties Kurt Seifried (Jul 25)
