summaryrefslogtreecommitdiff
path: root/kex.c
diff options
context:
space:
mode:
Diffstat (limited to 'kex.c')
-rw-r--r--kex.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/kex.c b/kex.c
index b0d47b5b1..b488090b4 100644
--- a/kex.c
+++ b/kex.c
@@ -28,7 +28,7 @@
28 */ 28 */
29 29
30#include "includes.h" 30#include "includes.h"
31RCSID("$OpenBSD: kex.c,v 1.8 2000/06/20 01:39:41 markus Exp $"); 31RCSID("$OpenBSD: kex.c,v 1.9 2000/07/10 16:30:25 ho Exp $");
32 32
33#include "ssh.h" 33#include "ssh.h"
34#include "ssh2.h" 34#include "ssh2.h"
@@ -287,13 +287,14 @@ char *
287get_match(char *client, char *server) 287get_match(char *client, char *server)
288{ 288{
289 char *sproposals[MAX_PROP]; 289 char *sproposals[MAX_PROP];
290 char *c, *s, *p, *ret; 290 char *c, *s, *p, *ret, *cp, *sp;
291 int i, j, nproposals; 291 int i, j, nproposals;
292 292
293 c = xstrdup(client); 293 c = cp = xstrdup(client);
294 s = xstrdup(server); 294 s = sp = xstrdup(server);
295 295
296 for ((p = strtok(s, SEP)), i=0; p; (p = strtok(NULL, SEP)), i++) { 296 for ((p = strsep(&sp, SEP)), i=0; p && *p != '\0';
297 (p = strsep(&sp, SEP)), i++) {
297 if (i < MAX_PROP) 298 if (i < MAX_PROP)
298 sproposals[i] = p; 299 sproposals[i] = p;
299 else 300 else
@@ -301,7 +302,8 @@ get_match(char *client, char *server)
301 } 302 }
302 nproposals = i; 303 nproposals = i;
303 304
304 for ((p = strtok(c, SEP)), i=0; p; (p = strtok(NULL, SEP)), i++) { 305 for ((p = strsep(&cp, SEP)), i=0; p && *p != '\0';
306 (p = strsep(&cp, SEP)), i++) {
305 for (j = 0; j < nproposals; j++) { 307 for (j = 0; j < nproposals; j++) {
306 if (strcmp(p, sproposals[j]) == 0) { 308 if (strcmp(p, sproposals[j]) == 0) {
307 ret = xstrdup(p); 309 ret = xstrdup(p);