"protocol error",
"key exchange failed",
"host authentication failed",
- "mac error",
+ "MAC error",
"compression error",
"service not available",
"protocol version not supported",
{
if (pkt->maxlen < length) {
unsigned char *body = pkt->body;
- int offset = body ? pkt->data - body : 0;
+ int offset = body ? body - pkt->data : 0;
pkt->maxlen = length + 256;
pkt->data = sresize(pkt->data, pkt->maxlen + APIEXTRA, unsigned char);
if (body) pkt->body = pkt->data + offset;
static struct Packet *ssh2_pkt_init(int pkt_type)
{
struct Packet *pkt = ssh_new_packet();
- pkt->length = 5;
+ pkt->length = 5; /* space for packet length + padding length */
pkt->forcepad = 0;
ssh_pkt_addbyte(pkt, (unsigned char) pkt_type);
- pkt->body = pkt->data + pkt->length;
+ pkt->body = pkt->data + pkt->length; /* after packet type */
return pkt;
}
if (keytype == SSH_KEYTYPE_SSH2) {
s->publickey_blob =
ssh2_userkey_loadpub(&ssh->cfg.keyfile, NULL,
- &s->publickey_bloblen, NULL);
+ &s->publickey_bloblen, NULL, NULL);
} else {
char *msgbuf;
logeventf(ssh, "Unable to use this key file (%s)",
(unsigned char *)ssh2_userkey_loadpub(&ssh->cfg.keyfile,
&algorithm,
&pub_blob_len,
- NULL);
+ NULL, NULL);
if (pub_blob) {
s->pktout = ssh2_pkt_init(SSH2_MSG_USERAUTH_REQUEST);
ssh2_pkt_addstring(s->pktout, s->username);