--- gpm-1.20.7/.gitignore +++ gpm-1.20.7-format-security/.gitignore @@ -11,6 +11,7 @@ Makefile Makefile.include /aclocal.m4 /autom4te.cache +/config.cache /config.log /config.status /configure @@ -29,7 +30,7 @@ Makefile.include /src/gpm /src/gpm2/tmp /src/gpm2/out -/src/lib/libgpm.so.* +/src/lib/libgpm.so* /src/prog/disable-paste /src/prog/display-buttons /src/prog/display-coords --- gpm-1.20.7/src/headers/gpm.h +++ gpm-1.20.7-format-security/src/headers/gpm.h @@ -280,10 +280,16 @@ int Gpm_GetSnapshot(Gpm_Event *ePtr); char *Gpm_get_console( void ); int Gpm_x_high_y(int base, int pot_y); int Gpm_cnt_digits(int number); -void gpm_oops(int line, char *file, char *text, ... ); +#ifdef __GNUC__ +__attribute__((__format__(printf, 3, 4))) +#endif +void gpm_oops(int line, const char *file, const char *text, ... ); /* report.c / report-lib.c */ -void gpm_report(int line, char *file, int stat, char *text, ... ); +#ifdef __GNUC__ +__attribute__((__format__(printf, 4, 5))) +#endif +void gpm_report(int line, const char *file, int stat, const char *text, ... ); #ifdef __cplusplus }; --- gpm-1.20.7/src/headers/message.h +++ gpm-1.20.7-format-security/src/headers/message.h @@ -226,7 +226,10 @@ /* #define GPM_MESS_ "" */ /* functions */ -void gpm_report(int line, char *file, int stat, char *text, ... ); +#ifdef __GNUC__ +__attribute__((__format__(printf, 4, 5))) +#endif +void gpm_report(int line, const char *file, int stat, const char *text, ... ); /* rest of wd.h */ #ifdef HAVE_SYSLOG_H --- gpm-1.20.7/src/lib/report-lib.c +++ gpm-1.20.7-format-security/src/lib/report-lib.c @@ -24,9 +24,9 @@ #include "headers/message.h" -void gpm_report(int line, char *file, int stat, char *text, ... ) +void gpm_report(int line, const char *file, int stat, const char *text, ... ) { - char *string = NULL; + const char *string = NULL; int log_level; va_list ap; @@ -47,7 +47,7 @@ void gpm_report(int line, char *file, in log_level = LOG_CRIT; break; } #ifdef HAVE_VSYSLOG - syslog(log_level, string); + syslog(log_level, "%s", string); vsyslog(log_level, text, ap); #else fprintf(stderr,"%s[%s(%d)]:\n",string,file,line); --- gpm-1.20.7/src/prog/gpm-root.y +++ gpm-1.20.7-format-security/src/prog/gpm-root.y @@ -443,6 +443,7 @@ void f__fix(struct passwd *pass) } /*---------------------------------------------------------------------*/ +#if 0 static int f_debug_one(FILE *f, Draw *draw) { DrawItem *ip; @@ -465,6 +466,7 @@ static int f_debug_one(FILE *f, Draw *dr #undef LINE return 0; } +#endif int f_debug(int mode, DrawItem *self, int uid) { @@ -960,10 +962,8 @@ static inline void scr_dump(int fd, FILE /*------------*/ static inline void scr_restore(int fd, FILE *f, unsigned char *buffer, int vc) { - int x,y, dumpfd; + int dumpfd; char dumpname[20]; - - x=buffer[2]; y=buffer[3]; /* WILL NOT WORK WITH DEVFS! FIXME! */ sprintf(dumpname,"/dev/vcsa%i",vc); --- gpm-1.20.7/src/prog/mouse-test.c +++ gpm-1.20.7-format-security/src/prog/mouse-test.c @@ -182,14 +182,14 @@ Gpm_Type *(*I_serial)(int fd, unsigned s /*----------------------------------------------------------------------------- Place the description here. -----------------------------------------------------------------------------*/ -int mousereopen(int oldfd, char *name, Gpm_Type *type) +int mousereopen(int oldfd, const char *name, Gpm_Type *type) { int fd; if (!type) type=mice+1; /* ms */ close(oldfd); usleep(100000); fd=open(name,O_RDWR); - if (fd < 0) gpm_report(GPM_PR_OOPS,name); + if (fd < 0) gpm_report(GPM_PR_OOPS, "%s", name); (*I_serial)(fd,type->flags,type,1,&type->name); /* ms initialization */ return fd; } --- gpm-1.20.7/src/report.c +++ gpm-1.20.7-format-security/src/report.c @@ -69,7 +69,7 @@ * */ -void gpm_report(int line, char *file, int stat, char *text, ... ) +void gpm_report(int line, const char *file, int stat, const char *text, ...) { FILE *console = NULL; va_list ap, ap3;