From db2790b6c76784951ecf7f5571be7803d018226b Mon Sep 17 00:00:00 2001 From: eric Date: Mon, 17 Dec 2018 08:56:31 +0000 Subject: [PATCH] set the return pointer to NULL when receiving a 0-sized data. ok gilles --- usr.sbin/smtpd/mproc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/usr.sbin/smtpd/mproc.c b/usr.sbin/smtpd/mproc.c index f1175f74b06..d5a934d4800 100644 --- a/usr.sbin/smtpd/mproc.c +++ b/usr.sbin/smtpd/mproc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mproc.c,v 1.31 2018/12/13 17:08:10 gilles Exp $ */ +/* $OpenBSD: mproc.c,v 1.32 2018/12/17 08:56:31 eric Exp $ */ /* * Copyright (c) 2012 Eric Faurot @@ -583,6 +583,11 @@ m_get_data(struct msg *m, const void **data, size_t *sz) { m_get_size(m, sz); + if (*sz == 0) { + *data = NULL; + return; + } + if (m->pos + *sz > m->end) m_error("msg too short"); -- 2.20.1