diff options
author | 2008-12-09 02:58:16 +0000 | |
---|---|---|
committer | 2008-12-09 02:58:16 +0000 | |
commit | c897d1c30ce97548c78858008ae0bdb2b8770287 (patch) | |
tree | 129c96fb7046cdca108b7bf23d26f41002badb48 | |
parent | Deal correctly with failures in remote stat() operation in sftp, (diff) | |
download | wireguard-openbsd-c897d1c30ce97548c78858008ae0bdb2b8770287.tar.xz wireguard-openbsd-c897d1c30ce97548c78858008ae0bdb2b8770287.zip |
don't leave junk (free'd) pointers around in Forward *fwd argument on
failure; avoids double-free in ~C -L handler when given an invalid
forwarding specification; bz#1539 report from adejong AT debian.org
via Colin Watson; ok markus@ dtucker@
-rw-r--r-- | usr.bin/ssh/readconf.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.bin/ssh/readconf.c b/usr.bin/ssh/readconf.c index 2f7ff09d05f..20271afb750 100644 --- a/usr.bin/ssh/readconf.c +++ b/usr.bin/ssh/readconf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readconf.c,v 1.172 2008/11/04 19:18:00 stevesk Exp $ */ +/* $OpenBSD: readconf.c,v 1.173 2008/12/09 02:58:16 djm Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -1288,9 +1288,13 @@ parse_forward(Forward *fwd, const char *fwdspec, int dynamicfwd) return (i); fail_free: - if (fwd->connect_host != NULL) + if (fwd->connect_host != NULL) { xfree(fwd->connect_host); - if (fwd->listen_host != NULL) + fwd->connect_host = NULL; + } + if (fwd->listen_host != NULL) { xfree(fwd->listen_host); + fwd->listen_host = NULL; + } return (0); } |