summaryrefslogtreecommitdiff
path: root/mail/metamail/patches/patch-ae
blob: e5771d2b613625884e91518360dfabac884058c7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$NetBSD: patch-ae,v 1.6 2012/12/30 05:38:55 dholland Exp $

- use required standard headers
- make sure index() is available 
- don't provide own declarations of standard functions
- fix path to sendmail (although, is this really adequately MI?)
- buffer length fix

--- metamail/splitmail.c.orig	1994-01-31 22:23:14.000000000 +0000
+++ metamail/splitmail.c
@@ -21,14 +21,20 @@ WITHOUT ANY EXPRESS OR IMPLIED WARRANTIE
  ******************************************************* */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <config.h>
 #include <ctype.h>
 #include <time.h>
 
+#ifndef index
+#define index(a, b) strchr(a, b)
+#endif
+
 #define MINCHUNKSIZE 20000 /* Better be enough to hold the headers, or we die! */
-extern char *malloc(), *index(), *getmyname();
+extern char *getmyname();
 
 #ifdef AMIGA
 #define Prototype   extern
@@ -40,9 +46,8 @@ extern char *malloc(), *index(), *getmyn
 #define NORMALDELIVERYCMD NormalDeliveryCmd
 #define VERBOSEDELIVERYCMD VerboseDeliveryCmd
 #else
-extern char *getenv();
-#define NORMALDELIVERYCMD "/usr/lib/sendmail -t -oi"
-#define VERBOSEDELIVERYCMD "/usr/lib/sendmail -t -v -oi"
+#define NORMALDELIVERYCMD "/usr/sbin/sendmail -t -oi"
+#define VERBOSEDELIVERYCMD "/usr/sbin/sendmail -t -v -oi"
 #endif
 
 usageexit() {
@@ -194,7 +199,7 @@ char **argv;
 	s = endofheader(from);  /* would be index(from, '\n'),
 				 but need to check for continuation lines */
         *s = '\0';
-	if (ShareThisHeader(from, SubjectBuf, &OrigID)) {
+	if (ShareThisHeader(from, SubjectBuf, sizeof(SubjectBuf), &OrigID)) {
 	    strcat(SharedHeaders, from);
 	    strcat(SharedHeaders, "\n");
 	}
@@ -339,9 +344,10 @@ static char *SharedHeads[] = {
     NULL
 };
 
-ShareThisHeader(s, SubjectBuf, OrigID)
+ShareThisHeader(s, SubjectBuf, size, OrigID)
 char *s;
 char *SubjectBuf;
+size_t size;
 char **OrigID;
 {
     int i;
@@ -361,7 +367,8 @@ char **OrigID;
     }
     if (!ULstrcmp(s, "subject")) {
         *colon = ':';
-        strcpy(SubjectBuf, ++colon);
+        strncpy(SubjectBuf, ++colon, size);
+	SubjectBuf[size - 1] = '\0';
         return(0);
     }
     if (!ULstrcmp(s, "content-type")) {