[openssh-commits] [openssh] 01/03: upstream: fix crash in recallocarray when deleting SendEnv

git+noreply at mindrot.org git+noreply at mindrot.org
Thu May 28 10:25:40 AEST 2020


This is an automated email from the git hooks/post-receive script.

dtucker pushed a commit to branch master
in repository openssh.

commit 16ea1fdbe736648f79a827219134331f8d9844fb
Author: djm at openbsd.org <djm at openbsd.org>
Date:   Wed May 27 21:25:18 2020 +0000

    upstream: fix crash in recallocarray when deleting SendEnv
    
    variables; spotted by & ok sthen@
    
    OpenBSD-Commit-ID: b881e8e849edeec5082b5c0a87d8d7cff091a8fd
---
 readconf.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/readconf.c b/readconf.c
index 2afcbaec..63ed7fd5 100644
--- a/readconf.c
+++ b/readconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readconf.c,v 1.329 2020/04/24 03:33:21 dtucker Exp $ */
+/* $OpenBSD: readconf.c,v 1.330 2020/05/27 21:25:18 djm Exp $ */
 /*
  * Author: Tatu Ylonen <ylo at cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
@@ -735,7 +735,7 @@ match_cfg_line(Options *options, char **condition, struct passwd *pw,
 static void
 rm_env(Options *options, const char *arg, const char *filename, int linenum)
 {
-	int i, j;
+	int i, j, onum_send_env = options->num_send_env;
 	char *cp;
 
 	/* Remove an environment variable */
@@ -758,6 +758,11 @@ rm_env(Options *options, const char *arg, const char *filename, int linenum)
 		options->num_send_env--;
 		/* NB. don't increment i */
 	}
+	if (onum_send_env != options->num_send_env) {
+		options->send_env = xrecallocarray(options->send_env,
+		    onum_send_env, options->num_send_env,
+		    sizeof(*options->send_env));
+	}
 }
 
 /*

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list