summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/smtpctl.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2019-01-14 09:37:41 +0000
committerEric Faurot <eric@cvs.openbsd.org>2019-01-14 09:37:41 +0000
commit465e416457a7160e2da066c8b0b8a80326a31946 (patch)
treec82d8bae86e417bdf6201f601c9781de1fa190a4 /usr.sbin/smtpd/smtpctl.c
parent7cfc0764f42a81e4bf43fa56c61e7d05b6321d4d (diff)
correctly retrieve envelope strings. fixes mailq output.
ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/smtpctl.c')
-rw-r--r--usr.sbin/smtpd/smtpctl.c11
1 files changed, 10 insertions, 1 deletions
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 <eric@openbsd.org>
@@ -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");