diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2017-10-12 16:22:34 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2017-10-12 16:22:34 +0000 |
commit | 4c4ddbde1d28a01cda66433cefc7efba54d33aca (patch) | |
tree | e350711ea5043288080d68f16077767d2bdd35c7 /libexec | |
parent | 33a93ebef92954d327444e2aaa33be3041f0f5a4 (diff) |
Check for asprintf() returning -1 instead of assuming that the
pointer will remain unchanged when fails. OK deraadt@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/spamd/spamd.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/libexec/spamd/spamd.c b/libexec/spamd/spamd.c index 185f7032d8d..7ccd5639465 100644 --- a/libexec/spamd/spamd.c +++ b/libexec/spamd/spamd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: spamd.c,v 1.151 2017/04/06 15:30:12 beck Exp $ */ +/* $OpenBSD: spamd.c,v 1.152 2017/10/12 16:22:33 millert Exp $ */ /* * Copyright (c) 2015 Henning Brauer <henning@openbsd.org> @@ -618,7 +618,6 @@ doreply(struct con *cp) nomatch: /* No match. give generic reply */ free(cp->obuf); - cp->obuf = NULL; if (cp->blacklists != NULL) cp->osize = asprintf(&cp->obuf, "%s-Sorry %s\n" @@ -629,6 +628,8 @@ nomatch: else cp->osize = asprintf(&cp->obuf, "451 Temporary failure, please try again later.\r\n"); + if (cp->osize == -1) + cp->obuf = NULL; cp->osize++; /* size includes the NUL (also changes -1 to 0) */ return; bad: |