From 857d9eb82cb1c1075c6e573fe1d7004c1490a36d Mon Sep 17 00:00:00 2001 From: naddy Date: Sun, 29 Feb 2004 16:41:07 +0000 Subject: Fix incorrect buffer overflow fix: pass the size of the target buffer rather than taking the size of the pointer. --- mail/metamail/Makefile | 2 +- mail/metamail/files/patch-ae | 49 +++++++++++++++++++++++++++++++++++++++----- 2 files changed, 45 insertions(+), 6 deletions(-) (limited to 'mail') diff --git a/mail/metamail/Makefile b/mail/metamail/Makefile index fe4f9458966d..fbc90ea886ab 100644 --- a/mail/metamail/Makefile +++ b/mail/metamail/Makefile @@ -7,7 +7,7 @@ PORTNAME= metamail PORTVERSION= 2.7 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= mail MASTER_SITES= ftp://thumper.bellcore.com/pub/nsb/ DISTNAME= mm${PORTVERSION} diff --git a/mail/metamail/files/patch-ae b/mail/metamail/files/patch-ae index 3cfe25c60518..b2fa41111c6a 100644 --- a/mail/metamail/files/patch-ae +++ b/mail/metamail/files/patch-ae @@ -1,5 +1,5 @@ -*** metamail/splitmail.c.orig Mon Jan 31 16:23:14 1994 ---- metamail/splitmail.c Wed Feb 18 15:39:09 2004 +*** metamail/splitmail.c.orig Mon Jan 31 23:23:14 1994 +--- metamail/splitmail.c Sat Feb 28 19:17:32 2004 *************** *** 41,48 **** #define VERBOSEDELIVERYCMD VerboseDeliveryCmd @@ -20,6 +20,45 @@ usageexit() { *************** +*** 194,200 **** + s = endofheader(from); /* would be index(from, '\n'), + but need to check for continuation lines */ + *s = '\0'; +! if (ShareThisHeader(from, SubjectBuf, &OrigID)) { + strcat(SharedHeaders, from); + strcat(SharedHeaders, "\n"); + } +--- 194,200 ---- + s = endofheader(from); /* would be index(from, '\n'), + but need to check for continuation lines */ + *s = '\0'; +! if (ShareThisHeader(from, SubjectBuf, sizeof(SubjectBuf), &OrigID)) { + strcat(SharedHeaders, from); + strcat(SharedHeaders, "\n"); + } +*************** +*** 339,347 **** + NULL + }; + +! ShareThisHeader(s, SubjectBuf, OrigID) + char *s; + char *SubjectBuf; + char **OrigID; + { + int i; +--- 339,348 ---- + NULL + }; + +! ShareThisHeader(s, SubjectBuf, size, OrigID) + char *s; + char *SubjectBuf; ++ size_t size; + char **OrigID; + { + int i; +*************** *** 361,367 **** } if (!ULstrcmp(s, "subject")) { @@ -28,12 +67,12 @@ return(0); } if (!ULstrcmp(s, "content-type")) { ---- 361,368 ---- +--- 362,369 ---- } if (!ULstrcmp(s, "subject")) { *colon = ':'; -! strncpy(SubjectBuf, ++colon, sizeof(SubjectBuf)); -! SubjectBuf[sizeof(SubjectBuf) - 1] = '\0'; +! strncpy(SubjectBuf, ++colon, size); +! SubjectBuf[size - 1] = '\0'; return(0); } if (!ULstrcmp(s, "content-type")) { -- cgit