diff options
Diffstat (limited to 'smtpd/smtpctl.c')
-rw-r--r-- | smtpd/smtpctl.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/smtpd/smtpctl.c b/smtpd/smtpctl.c index 6e91ac29..42c018b9 100644 --- a/smtpd/smtpctl.c +++ b/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> @@ -269,6 +269,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"); |