ssh->rdpkt2_state.incoming_sequence = 0;
s->vstring[s->vslen] = 0;
- s->vstring[strcspn(s->vstring, "\r\n")] = '\0';/* remove EOL chars */
+ s->vstring[strcspn(s->vstring, "\015\012")] = '\0';/* remove EOL chars */
{
char *vlog;
vlog = snewn(20 + s->vslen, char);
/*
* Construct a v2 version string.
*/
- verstring = dupprintf("SSH-2.0-%s\n", sshver);
+ verstring = dupprintf("SSH-2.0-%s\015\012", sshver);
ssh->version = 2;
} else {
/*
* Construct a v1 version string.
*/
- verstring = dupprintf("SSH-%s-%s\n",
+ verstring = dupprintf("SSH-%s-%s\012",
(ssh_versioncmp(s->version, "1.5") <= 0 ?
s->version : "1.5"),
sshver);
* Hash our version string and their version string.
*/
SHA_Init(&ssh->exhashbase);
- sha_string(&ssh->exhashbase, verstring, strlen(verstring)-1);
- sha_string(&ssh->exhashbase, s->vstring, strcspn(s->vstring, "\r\n"));
+ sha_string(&ssh->exhashbase, verstring,
+ strcspn(verstring, "\015\012"));
+ sha_string(&ssh->exhashbase, s->vstring,
+ strcspn(s->vstring, "\015\012"));
/*
* Initialise SSHv2 protocol.
ssh->s_rdpkt = ssh1_rdpkt;
}
logeventf(ssh, "We claim version: %.*s",
- strlen(verstring)-1, verstring);
+ strcspn(verstring, "\015\012"), verstring);
sk_write(ssh->s, verstring, strlen(verstring));
sfree(verstring);
}
sfree(c);
}
freetree234(ssh->channels);
+ ssh->channels = NULL;
}
if (ssh->rportfwds) {
while ((pf = delpos234(ssh->rportfwds, 0)) != NULL)
sfree(pf);
freetree234(ssh->rportfwds);
+ ssh->rportfwds = NULL;
}
sfree(ssh->deferred_send_data);
if (ssh->x11auth)