Blame SOURCES/sendmail-8.15.2-format-security.patch

813923
diff --git a/sendmail/envelope.c b/sendmail/envelope.c
813923
index bae6b00..beb91a1 100644
813923
--- a/sendmail/envelope.c
813923
+++ b/sendmail/envelope.c
813923
@@ -323,7 +323,7 @@ dropenvelope(e, fulldrop, split)
813923
 
813923
 			/* don't free, allocated from e_rpool */
813923
 			e->e_message = sm_rpool_strdup_x(e->e_rpool, buf);
813923
-			message(buf);
813923
+			message("%s", buf);
813923
 			e->e_flags |= EF_CLRQUEUE;
813923
 		}
813923
 		if (msg_timeout == MSG_NOT_BY)
813923
@@ -420,7 +420,7 @@ dropenvelope(e, fulldrop, split)
813923
 				/* don't free, allocated from e_rpool */
813923
 				e->e_message = sm_rpool_strdup_x(e->e_rpool,
813923
 								 buf);
813923
-				message(buf);
813923
+				message("%s", buf);
813923
 				e->e_flags |= EF_WARNING;
813923
 			}
813923
 			if (msg_timeout == MSG_WARN_BY)
813923
diff --git a/sendmail/parseaddr.c b/sendmail/parseaddr.c
813923
index 2adb39c..ba99414 100644
813923
--- a/sendmail/parseaddr.c
813923
+++ b/sendmail/parseaddr.c
813923
@@ -218,7 +218,7 @@ parseaddr(addr, a, flags, delim, delimptr, e, isrcpt)
813923
 			msg = "Deferring message until queue run";
813923
 		if (tTd(20, 1))
813923
 			sm_dprintf("parseaddr: queueing message\n");
813923
-		message(msg);
813923
+		message("%s", msg);
813923
 		if (e->e_message == NULL && e->e_sendmode != SM_DEFER)
813923
 			e->e_message = sm_rpool_strdup_x(e->e_rpool, msg);
813923
 		a->q_state = QS_QUEUEUP;
813923
diff --git a/sendmail/srvrsmtp.c b/sendmail/srvrsmtp.c
813923
index ba636a8..46c5356 100644
813923
--- a/sendmail/srvrsmtp.c
813923
+++ b/sendmail/srvrsmtp.c
813923
@@ -122,6 +122,26 @@ extern ENVELOPE	BlankEnvelope;
813923
 #define SKIP_SPACE(s)	while (isascii(*s) && isspace(*s))	\
813923
 				(s)++
813923
 
813923
+static inline void
813923
+message1(fmt)
813923
+	char *fmt;
813923
+{
813923
+	if (strchr(fmt, '%') == NULL)
813923
+		message(fmt, NULL);
813923
+	else
813923
+		message("%s", fmt);
813923
+}
813923
+
813923
+static inline void
813923
+usrerr1(fmt)
813923
+	char *fmt;
813923
+{
813923
+	if (strchr(fmt, '%') == NULL)
813923
+		usrerr(fmt, NULL);
813923
+	else
813923
+		usrerr("%s", fmt);
813923
+}
813923
+
813923
 /*
813923
 **  PARSE_ESMTP_ARGS -- parse EMSTP arguments (for MAIL, RCPT)
813923
 **
813923
@@ -578,13 +598,13 @@ static bool	smtp_data __P((SMTP_T *, ENVELOPE *));
813923
 				bool tsave = QuickAbort;		\
813923
 									\
813923
 				QuickAbort = false;			\
813923
-				usrerr(response);			\
813923
+				usrerr1(response);			\
813923
 				QuickAbort = tsave;			\
813923
 				e->e_sendqueue = NULL;			\
813923
 				goto doquit;				\
813923
 			}						\
813923
 			else						\
813923
-				usrerr(response);			\
813923
+				usrerr1(response);			\
813923
 			break;						\
813923
 									\
813923
 		  case SMFIR_REJECT:					\
813923
@@ -931,7 +951,7 @@ smtp(nullserver, d_flags, e)
813923
 	}
813923
 	else if (strncmp(nullserver, "421 ", 4) == 0)
813923
 	{
813923
-		message(nullserver);
813923
+		message1(nullserver);
813923
 		goto doquit;
813923
 	}
813923
 
813923
@@ -1849,7 +1869,7 @@ smtp(nullserver, d_flags, e)
813923
 				if (nullserver != NULL)
813923
 				{
813923
 					if (ISSMTPREPLY(nullserver))
813923
-						usrerr(nullserver);
813923
+						usrerr1(nullserver);
813923
 					else
813923
 						usrerr("550 5.0.0 %s",
813923
 						       nullserver);
813923
@@ -2449,7 +2469,7 @@ smtp(nullserver, d_flags, e)
813923
 					tempfail = true;
813923
 					smtp.sm_milterize = false;
813923
 					if (response != NULL)
813923
-						usrerr(response);
813923
+						usrerr1(response);
813923
 					else
813923
 						message("421 4.7.0 %s closing connection",
813923
 							MyHostName);
813923
@@ -3656,7 +3676,7 @@ smtp_data(smtp, e)
813923
 				(void) extenhsc(response + 4, ' ', e->e_enhsc);
813923
 #endif /* _FFR_MILTER_ENHSC */
813923
 
813923
-			usrerr(response);
813923
+			usrerr1(response);
813923
 			if (strncmp(response, "421 ", 4) == 0
813923
 			    || strncmp(response, "421-", 4) == 0)
813923
 			{
813923
@@ -3776,7 +3796,7 @@ smtp_data(smtp, e)
813923
 			if (ISSMTPCODE(response))
813923
 				(void) extenhsc(response + 4, ' ', e->e_enhsc);
813923
 #endif /* _FFR_MILTER_ENHSC */
813923
-			usrerr(response);
813923
+			usrerr1(response);
813923
 			if (strncmp(response, "421 ", 4) == 0
813923
 			    || strncmp(response, "421-", 4) == 0)
813923
 				rv = false;