From c63d98038ab7b624377dd46c3218d3850ba7f252 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sat, 17 Aug 2002 18:28:43 +0000 Subject: [PATCH] Include protection for , and . --- tools/fnt2bdf.c | 24 ++++++++++++++++++++---- tools/makedep.c | 4 +++- tools/widl/header.c | 4 +++- tools/widl/parser.l | 6 +++++- tools/widl/proxy.c | 4 +++- tools/widl/widl.c | 4 +++- tools/winebuild/import.c | 4 +++- tools/winebuild/res16.c | 8 ++++++-- tools/winebuild/res32.c | 8 ++++++-- tools/winedump/debug.c | 13 +++++++++---- tools/winedump/pe.c | 12 +++++++++--- tools/wpp/preproc.c | 4 +++- tools/wrc/wrc.c | 4 +++- 13 files changed, 76 insertions(+), 23 deletions(-) diff --git a/tools/fnt2bdf.c b/tools/fnt2bdf.c index c0a855e0ffb..79d9dbeb43d 100644 --- a/tools/fnt2bdf.c +++ b/tools/fnt2bdf.c @@ -30,8 +30,17 @@ #include #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include +#ifdef HAVE_IO_H +# include +#endif + +#ifndef O_BINARY +# define O_BINARY 0 +#endif #include "fnt2bdf.h" #include "module.h" @@ -146,6 +155,13 @@ int parse_fnt_data(unsigned char* file_buffer, int length) t = return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion); if( t != 0x300 && t != 0x200) return ERROR_VERSION; + t = return_data_value(dfShort, &cpe_font_struct.hdr.fi.dfType); + if (t & 1) + { + fprintf(stderr, "Vector fonts not supported\n"); + return ERROR_DATA; + } + t = return_data_value(dfLong, &cpe_font_struct.hdr.dfSize); if( t > length ) return ERROR_SIZE; else @@ -176,7 +192,7 @@ int parse_fnt_data(unsigned char* file_buffer, int length) if( return_data_value(dfShort, &cpe_font_struct.hdr.dfVersion) == 0x200) { cpe_font_struct.dfCharTable[ic].charOffset = return_data_value(dfShort, &file_buffer[l_ptr]); - l_ptr += 2; /* bump by sizeof(long) */ + l_ptr += 2; /* bump by sizeof(short) */ } else { /* Windows Version 3.0 type font */ cpe_font_struct.dfCharTable[ic].charOffset = @@ -540,7 +556,7 @@ int main(int argc, char **argv) parse_options( argc, argv); - if( (fd = open( g_lpstrInputFile, O_RDONLY)) ) + if( (fd = open( g_lpstrInputFile, O_RDONLY | O_BINARY)) ) { int i; struct stat file_stat; @@ -574,7 +590,7 @@ int main(int argc, char **argv) unsigned short size_shift = return_data_value(dfShort, lpdata); unsigned char* lpfont = NULL; unsigned offset; - unsigned length; + int length; for( j = 0; j < count; j++, pFontStorage++ ) { diff --git a/tools/makedep.c b/tools/makedep.c index 2a2174a5a24..bf51ba0e4dd 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -25,7 +25,9 @@ #include #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif /* Max first-level includes per file */ #define MAX_INCLUDES 200 diff --git a/tools/widl/header.c b/tools/widl/header.c index 16be1f9a9bf..c910a9ab420 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -22,7 +22,9 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include diff --git a/tools/widl/parser.l b/tools/widl/parser.l index d89e479160a..2f3e6022aa0 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -33,12 +33,16 @@ uuid {hexd}{8}-{hexd}{4}-{hexd}{4}-{hexd}{4}-{hexd}{12} %{ +#include "config.h" + #include #include #include #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include "widl.h" #include "utils.h" diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index a0677bd8705..2cf3ff1caf8 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -22,7 +22,9 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 8dfbcd513c2..9c26b82b4e0 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -23,7 +23,9 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 054e885935d..7a4c2a4aac7 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -26,7 +26,9 @@ #include #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include "build.h" diff --git a/tools/winebuild/res16.c b/tools/winebuild/res16.c index b91ffa3fbf7..3694bef2b4c 100644 --- a/tools/winebuild/res16.c +++ b/tools/winebuild/res16.c @@ -25,9 +25,13 @@ #include #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include -#include +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif diff --git a/tools/winebuild/res32.c b/tools/winebuild/res32.c index ed4a38aa0f0..8eaeca44bea 100644 --- a/tools/winebuild/res32.c +++ b/tools/winebuild/res32.c @@ -25,9 +25,13 @@ #include #include #include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif #include -#include +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif diff --git a/tools/winedump/debug.c b/tools/winedump/debug.c index 5fa3a41ae26..bd9164e307f 100644 --- a/tools/winedump/debug.c +++ b/tools/winedump/debug.c @@ -25,10 +25,16 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include -#include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif @@ -480,4 +486,3 @@ void dump_codeview(unsigned long base, unsigned long len) { dump_codeview_headers(base, len); } - diff --git a/tools/winedump/pe.c b/tools/winedump/pe.c index 943fbdf30d5..a5832a08479 100644 --- a/tools/winedump/pe.c +++ b/tools/winedump/pe.c @@ -23,10 +23,16 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include -#include -#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif #ifdef HAVE_SYS_MMAN_H #include #endif diff --git a/tools/wpp/preproc.c b/tools/wpp/preproc.c index 8978c251232..868a2b0bb84 100644 --- a/tools/wpp/preproc.c +++ b/tools/wpp/preproc.c @@ -24,7 +24,9 @@ #include #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include "wpp_private.h" diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c index 463b38cf015..de3a0ccc6ad 100644 --- a/tools/wrc/wrc.c +++ b/tools/wrc/wrc.c @@ -52,7 +52,9 @@ #include #include -#include +#ifdef HAVE_UNISTD_H +# include +#endif #include #include #include -- 2.11.4.GIT