[openssh-commits] [openssh] 06/10: upstream: fix leaks of config objects in
git+noreply at mindrot.org
git+noreply at mindrot.org
Thu Sep 25 17:02:37 AEST 2025
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit d0c1e73d408a24b2db18c0aa1a0108bea0f24210
Author: djm at openbsd.org <djm at openbsd.org>
AuthorDate: Thu Sep 25 06:31:42 2025 +0000
upstream: fix leaks of config objects in
mm_decode_activate_server_options ok dtucker@ tb@
OpenBSD-Commit-ID: 211f4d7d02e847bd1bcb460f6beb11658809a742
---
monitor_wrap.c | 13 ++++++++++++-
servconf.c | 4 ++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/monitor_wrap.c b/monitor_wrap.c
index 7a5ac6a9d..33494b73f 100644
--- a/monitor_wrap.c
+++ b/monitor_wrap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: monitor_wrap.c,v 1.141 2025/09/05 10:17:21 dtucker Exp $ */
+/* $OpenBSD: monitor_wrap.c,v 1.142 2025/09/25 06:31:42 djm Exp $ */
/*
* Copyright 2002 Niels Provos <provos at citi.umich.edu>
* Copyright 2002 Markus Friedl <markus at openbsd.org>
@@ -319,6 +319,17 @@ mm_decode_activate_server_options(struct ssh *ssh, struct sshbuf *m)
log_verbose_reset();
for (i = 0; i < options.num_log_verbose; i++)
log_verbose_add(options.log_verbose[i]);
+
+ /* use the macro hell to clean up too */
+#define M_CP_STROPT(x) free(newopts->x)
+#define M_CP_STRARRAYOPT(x, nx) do { \
+ for (i = 0; i < newopts->nx; i++) \
+ free(newopts->x[i]); \
+ free(newopts->x); \
+ } while (0)
+ COPY_MATCH_STRING_OPTS();
+#undef M_CP_STROPT
+#undef M_CP_STRARRAYOPT
free(newopts);
}
diff --git a/servconf.c b/servconf.c
index 532c09553..48ec8c4ec 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: servconf.c,v 1.434 2025/09/02 09:40:19 djm Exp $ */
+/* $OpenBSD: servconf.c,v 1.435 2025/09/25 06:31:42 djm Exp $ */
/*
* Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
* All rights reserved
@@ -2966,7 +2966,7 @@ copy_set_server_options(ServerOptions *dst, ServerOptions *src, int preauth)
#define M_CP_STROPT(n) do {\
if (src->n != NULL && dst->n != src->n) { \
free(dst->n); \
- dst->n = src->n; \
+ dst->n = xstrdup(src->n); \
} \
} while(0)
#define M_CP_STRARRAYOPT(s, num_s) do {\
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list