summaryrefslogtreecommitdiff
path: root/usr.sbin/smtpd/lka_session.c
diff options
context:
space:
mode:
authorEric Faurot <eric@cvs.openbsd.org>2013-01-31 18:34:44 +0000
committerEric Faurot <eric@cvs.openbsd.org>2013-01-31 18:34:44 +0000
commitab4613f907295576d57cc97e4e21ecdcfec9b147 (patch)
tree88d4069d85291dd9d4c1e812fd81d8d74c555be3 /usr.sbin/smtpd/lka_session.c
parent607436a02a6968961ade01e8dfc0543ce3a1362a (diff)
assorted fixes spotted by Coverity.
some log message updates. ok gilles@
Diffstat (limited to 'usr.sbin/smtpd/lka_session.c')
-rw-r--r--usr.sbin/smtpd/lka_session.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/smtpd/lka_session.c b/usr.sbin/smtpd/lka_session.c
index 5b4f09fcf53..5a71fd494bf 100644
--- a/usr.sbin/smtpd/lka_session.c
+++ b/usr.sbin/smtpd/lka_session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lka_session.c,v 1.52 2013/01/28 11:09:53 gilles Exp $ */
+/* $OpenBSD: lka_session.c,v 1.53 2013/01/31 18:34:43 eric Exp $ */
/*
* Copyright (c) 2011 Gilles Chehade <gilles@poolp.org>
@@ -199,7 +199,7 @@ lka_resume(struct lka_session *lks)
m_close(p_queue);
}
- expand_free(&lks->expand);
+ expand_clear(&lks->expand);
tree_xpop(&sessions, lks->id);
free(lks);
}
@@ -644,7 +644,11 @@ lka_expand_format(char *buf, size_t len, const struct envelope *ep,
/* extract token from %{token} */
if ((size_t)(ebuf - pbuf) - 1 >= sizeof token)
return 0;
- *strchr(memcpy(token, pbuf+2, ebuf-pbuf-1), '}') = '\0';
+
+ memcpy(token, pbuf+2, ebuf-pbuf-1);
+ if (strchr(token, '}') == NULL)
+ return 0;
+ *strchr(token, '}') = '\0';
exptoklen = lka_expand_token(exptok, sizeof exptok, token, ep,
ui);