From: eric Date: Mon, 14 Jan 2019 09:37:40 +0000 (+0000) Subject: correctly retrieve envelope strings. fixes mailq output. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=5b1f635fa98212169b8d7378da382648f36df091;p=openbsd correctly retrieve envelope strings. fixes mailq output. ok gilles@ --- diff --git a/usr.sbin/smtpd/smtpctl.c b/usr.sbin/smtpd/smtpctl.c index a78c26fa263..4b44d9dd30a 100644 --- a/usr.sbin/smtpd/smtpctl.c +++ b/usr.sbin/smtpd/smtpctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: smtpctl.c,v 1.162 2018/05/31 21:06:12 gilles Exp $ */ +/* $OpenBSD: smtpctl.c,v 1.163 2019/01/14 09:37:40 eric Exp $ */ /* * Copyright (c) 2013 Eric Faurot @@ -248,6 +248,15 @@ srv_get_string(const char **s) if (rlen == 0) errx(1, "message too short"); + rlen -= 1; + if (*rdata++ == '\0') { + *s = NULL; + return; + } + + if (rlen == 0) + errx(1, "bogus string"); + end = memchr(rdata, 0, rlen); if (end == NULL) errx(1, "unterminated string");