summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortb <tb@openbsd.org>2020-12-31 14:17:12 +0000
committertb <tb@openbsd.org>2020-12-31 14:17:12 +0000
commit75e9e6e594a33cecf7dd9499e12cde71096263d8 (patch)
tree0d2234266748b2f5b79ee136787c839b41404ece
parentDon't leak access.log and error.log on reload. (diff)
downloadwireguard-openbsd-75e9e6e594a33cecf7dd9499e12cde71096263d8.tar.xz
wireguard-openbsd-75e9e6e594a33cecf7dd9499e12cde71096263d8.zip
Don't leak the log message in server_sendlog
While there, use the length calculated by vasprintf() instead of using strlen needlessly. ok claudio florian
-rw-r--r--usr.sbin/httpd/server.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/httpd/server.c b/usr.sbin/httpd/server.c
index a624a056977..20b31a39e50 100644
--- a/usr.sbin/httpd/server.c
+++ b/usr.sbin/httpd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.121 2020/10/11 03:21:44 tb Exp $ */
+/* $OpenBSD: server.c,v 1.122 2020/12/31 14:17:12 tb Exp $ */
/*
* Copyright (c) 2006 - 2015 Reyk Floeter <reyk@openbsd.org>
@@ -1251,12 +1251,14 @@ server_sendlog(struct server_config *srv_conf, int cmd, const char *emsg, ...)
iov[0].iov_base = &srv_conf->id;
iov[0].iov_len = sizeof(srv_conf->id);
iov[1].iov_base = msg;
- iov[1].iov_len = strlen(msg) + 1;
+ iov[1].iov_len = ret + 1;
if (proc_composev(httpd_env->sc_ps, PROC_LOGGER, cmd, iov, 2) != 0) {
log_warn("%s: failed to compose imsg", __func__);
+ free(msg);
return;
}
+ free(msg);
}
void