summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortobhe <tobhe@cvs.openbsd.org>2020-03-17 09:01:54 +0000
committertobhe <tobhe@cvs.openbsd.org>2020-03-17 09:01:54 +0000
commit272f9c770c8aec0710047afa105b3073a35a85a4 (patch)
tree42053dfd2d76f6a2d084b8b192e2874860cc7bd3
parent40d142be396d6cca619078e7eeb91e0088559052 (diff)
Exit when m_get_string() returns NULL to prevent nullptr dereference in
strlen(). ok millert@
-rw-r--r--usr.sbin/smtpd/mproc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c
index aa19c7d48f6..5eff4adfb33 100644
--- a/usr.sbin/smtpd/mproc.c
+++ b/usr.sbin/smtpd/mproc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mproc.c,v 1.35 2019/10/03 05:50:28 gilles Exp $ */
+/* $OpenBSD: mproc.c,v 1.36 2020/03/17 09:01:53 tobhe Exp $ */
/*
* Copyright (c) 2012 Eric Faurot <eric@faurot.net>
@@ -637,6 +637,8 @@ m_get_envelope(struct msg *m, struct envelope *evp)
m_get_evpid(m, &evpid);
m_get_string(m, &buf);
+ if (buf == NULL)
+ fatalx("empty envelope buffer");
if (!envelope_load_buffer(evp, buf, strlen(buf)))
fatalx("failed to retrieve envelope");