|
1 |
| -/* $OpenBSD: compat.c,v 1.120 2022/07/01 03:35:45 dtucker Exp $ */ |
| 1 | +/* $OpenBSD: compat.c,v 1.121 2023/02/02 12:10:05 djm Exp $ */ |
2 | 2 | /*
|
3 | 3 | * Copyright (c) 1999, 2000, 2001, 2002 Markus Friedl. All rights reserved.
|
4 | 4 | *
|
@@ -190,26 +190,26 @@ compat_pkalg_proposal(struct ssh *ssh, char *pkalg_prop)
|
190 | 190 | char *
|
191 | 191 | compat_kex_proposal(struct ssh *ssh, char *p)
|
192 | 192 | {
|
193 |
| - char *cp = NULL; |
| 193 | + char *cp = NULL, *cp2 = NULL; |
194 | 194 |
|
195 | 195 | if ((ssh->compat & (SSH_BUG_CURVE25519PAD|SSH_OLD_DHGEX)) == 0)
|
196 | 196 | return xstrdup(p);
|
197 | 197 | debug2_f("original KEX proposal: %s", p);
|
198 | 198 | if ((ssh->compat & SSH_BUG_CURVE25519PAD) != 0)
|
199 |
| - if ((p = match_filter_denylist(p, |
| 199 | + if ((cp = match_filter_denylist(p, |
200 | 200 |
|
201 | 201 | fatal("match_filter_denylist failed");
|
202 | 202 | if ((ssh->compat & SSH_OLD_DHGEX) != 0) {
|
203 |
| - cp = p; |
204 |
| - if ((p = match_filter_denylist(p, |
| 203 | + if ((cp2 = match_filter_denylist(cp ? cp : p, |
205 | 204 | "diffie-hellman-group-exchange-sha256,"
|
206 | 205 | "diffie-hellman-group-exchange-sha1")) == NULL)
|
207 | 206 | fatal("match_filter_denylist failed");
|
208 | 207 | free(cp);
|
| 208 | + cp = cp2; |
209 | 209 | }
|
210 |
| - debug2_f("compat KEX proposal: %s", p); |
211 |
| - if (*p == '\0') |
| 210 | + if (cp == NULL || *cp == '\0') |
212 | 211 | fatal("No supported key exchange algorithms found");
|
213 |
| - return p; |
| 212 | + debug2_f("compat KEX proposal: %s", cp); |
| 213 | + return cp; |
214 | 214 | }
|
215 | 215 |
|
0 commit comments