From: eric Date: Mon, 17 Dec 2018 08:56:31 +0000 (+0000) Subject: set the return pointer to NULL when receiving a 0-sized data. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=db2790b6c76784951ecf7f5571be7803d018226b;p=openbsd set the return pointer to NULL when receiving a 0-sized data. ok gilles --- 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");