From e64a650594faa0638c4e3440b36ad7938b3705d4 Mon Sep 17 00:00:00 2001 From: Olli Hauer Date: Wed, 30 Mar 2011 18:26:40 +0000 Subject: [PATCH] - add patches to fix some security and functionality issues PR: ports/155934 Submitted by: Michael Gmelin Approved by: Kiyoshi MATSUI (maintainer) --- devel/mcpp/Makefile | 1 + devel/mcpp/files/patch-src__internal.H | 19 +++++++++++++++++++ devel/mcpp/files/patch-src__main.c | 11 +++++++++++ devel/mcpp/files/patch-src__support.c | 20 ++++++++++++++++++++ devel/mcpp/files/patch-src__system.c | 21 +++++++++++++++++++++ 5 files changed, 72 insertions(+) create mode 100644 devel/mcpp/files/patch-src__internal.H create mode 100644 devel/mcpp/files/patch-src__main.c create mode 100644 devel/mcpp/files/patch-src__support.c create mode 100644 devel/mcpp/files/patch-src__system.c diff --git a/devel/mcpp/Makefile b/devel/mcpp/Makefile index ea25fb3ed1a0..2ebf54345355 100644 --- a/devel/mcpp/Makefile +++ b/devel/mcpp/Makefile @@ -7,6 +7,7 @@ PORTNAME= mcpp PORTVERSION= 2.7.2 +PORTREVISION= 1 CATEGORIES= devel MASTER_SITES= SF/${PORTNAME}/${PORTNAME}/V.${PORTVERSION} diff --git a/devel/mcpp/files/patch-src__internal.H b/devel/mcpp/files/patch-src__internal.H new file mode 100644 index 000000000000..c21a9a6f765e --- /dev/null +++ b/devel/mcpp/files/patch-src__internal.H @@ -0,0 +1,19 @@ +--- ./src/internal.H.orig 2008-08-27 15:01:16.000000000 +0200 ++++ ./src/internal.H 2011-03-30 19:57:37.000000000 +0200 +@@ -390,6 +390,8 @@ + extern char identifier[]; /* Lastly scanned name */ + extern IFINFO ifstack[]; /* Information of #if nesting */ + extern char work_buf[]; ++extern FILEINFO * sh_file; ++extern int sh_line; + /* Temporary buffer for directive line and macro expansion */ + + /* main.c */ +@@ -557,6 +559,6 @@ + #endif + #endif + +-#if HOST_HAVE_STPCPY ++#if HOST_HAVE_STPCPY && !defined(stpcpy) + extern char * stpcpy( char * dest, const char * src); + #endif diff --git a/devel/mcpp/files/patch-src__main.c b/devel/mcpp/files/patch-src__main.c new file mode 100644 index 000000000000..2bfbd5c674bf --- /dev/null +++ b/devel/mcpp/files/patch-src__main.c @@ -0,0 +1,11 @@ +--- ./src/main.c.orig 2008-11-05 09:34:46.000000000 +0100 ++++ ./src/main.c 2011-03-30 19:57:37.000000000 +0200 +@@ -326,6 +326,8 @@ + = FALSE; + option_flags.trig = TRIGRAPHS_INIT; + option_flags.dig = DIGRAPHS_INIT; ++ sh_file = NULL; ++ sh_line = 0; + } + + int mcpp_lib_main diff --git a/devel/mcpp/files/patch-src__support.c b/devel/mcpp/files/patch-src__support.c new file mode 100644 index 000000000000..08de1ec8b695 --- /dev/null +++ b/devel/mcpp/files/patch-src__support.c @@ -0,0 +1,20 @@ +--- ./src/support.c.orig 2008-06-10 10:32:33.000000000 +0200 ++++ ./src/support.c 2011-03-30 19:57:37.000000000 +0200 +@@ -188,7 +188,7 @@ + size_t length + ) + { +- if (mem_buf_p->bytes_avail < length) { /* Need to allocate more memory */ ++ if (mem_buf_p->bytes_avail < length + 1) { /* Need to allocate more memory */ + size_t size = MAX( BUF_INCR_SIZE, length); + + if (mem_buf_p->buffer == NULL) { /* 1st append */ +@@ -1722,6 +1722,8 @@ + sp -= 2; + while (*sp != '\n') /* Until end of line */ + mcpp_fputc( *sp++, OUT); ++ mcpp_fputc( '\n', OUT); ++ wrong_line = TRUE; + } + goto end_line; + default: /* Not a comment */ diff --git a/devel/mcpp/files/patch-src__system.c b/devel/mcpp/files/patch-src__system.c new file mode 100644 index 000000000000..5e80aabb2378 --- /dev/null +++ b/devel/mcpp/files/patch-src__system.c @@ -0,0 +1,21 @@ +--- ./src/system.c.orig 2008-11-26 10:53:51.000000000 +0100 ++++ ./src/system.c 2011-03-30 19:57:37.000000000 +0200 +@@ -3858,6 +3858,9 @@ + } + #endif + ++FILEINFO* sh_file; ++int sh_line; ++ + void sharp( + FILEINFO * sharp_file, + int flag /* Flag to append to the line for GCC */ +@@ -3868,8 +3871,6 @@ + * else (i.e. 'sharp_file' is NULL) 'infile'. + */ + { +- static FILEINFO * sh_file; +- static int sh_line; + FILEINFO * file; + int line; +