network/opensmtpd: Apply OpenBSD 6.4 patch 20.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Richard Narron 2019-08-10 01:09:59 +07:00 committed by Willy Sudiarto Raharjo
parent 2ccb4f74c6
commit 66062b50d0
No known key found for this signature in database
GPG key ID: 887B8374D7333381
2 changed files with 31 additions and 1 deletions

View file

@ -0,0 +1,27 @@
--- a/smtpd/smtp_session.c 3 Sep 2018 19:01:29 -0000 1.337
+++ b/smtpd/smtp_session.c 1 Aug 2019 21:18:53 -0000
@@ -1904,15 +1904,21 @@ smtp_reply(struct smtp_session *s, char
{
va_list ap;
int n;
- char buf[LINE_MAX], tmp[LINE_MAX];
+ char buf[LINE_MAX*2], tmp[LINE_MAX*2];
va_start(ap, fmt);
n = vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- if (n == -1 || n >= LINE_MAX)
- fatalx("smtp_reply: line too long");
+ if (n < 0)
+ fatalx("smtp_reply: response format error");
if (n < 4)
fatalx("smtp_reply: response too short");
+ if (n >= (int)sizeof buf) {
+ /* only first three bytes are used by SMTP logic,
+ * so if _our_ reply does not fit entirely in the
+ * buffer, it's ok to truncate.
+ */
+ }
log_trace(TRACE_SMTP, "smtp: %p: >>> %s", s, buf);

View file

@ -25,7 +25,7 @@
PRGNAM=opensmtpd
VERSION=${VERSION:-6.0.3p1}
BUILD=${BUILD:-2}
BUILD=${BUILD:-3}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -92,6 +92,9 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
# fix reply buffer overflow
cat $CWD/openbsd64-020-smtpd.patch | patch -p1
CFLAGS="$SLKCFLAGS -D_DEFAULT_SOURCE" \
CXXFLAGS="$SLKCFLAGS" \
./configure \