зеркало из https://github.com/github/putty.git
Fix an error I introduced into SSH packet logging in r5642: some outgoing
packets over about 256 bytes would be logged with 12 bytes of preceding
garbage. (But the rest of the packet was logged in its entirety. This
holds for packets where (int(len/256)%2)==1, with an appropriate fudge
factor applied to `len'.) Ahem.
[originally from svn r6429]
[r5642 == c09d885b27
]
This commit is contained in:
Родитель
24bd4cfdde
Коммит
69ac38c1a8
6
ssh.c
6
ssh.c
|
@ -1587,7 +1587,7 @@ static void ssh_pkt_ensure(struct Packet *pkt, int length)
|
||||||
{
|
{
|
||||||
if (pkt->maxlen < length) {
|
if (pkt->maxlen < length) {
|
||||||
unsigned char *body = pkt->body;
|
unsigned char *body = pkt->body;
|
||||||
int offset = body ? pkt->data - body : 0;
|
int offset = body ? body - pkt->data : 0;
|
||||||
pkt->maxlen = length + 256;
|
pkt->maxlen = length + 256;
|
||||||
pkt->data = sresize(pkt->data, pkt->maxlen + APIEXTRA, unsigned char);
|
pkt->data = sresize(pkt->data, pkt->maxlen + APIEXTRA, unsigned char);
|
||||||
if (body) pkt->body = pkt->data + offset;
|
if (body) pkt->body = pkt->data + offset;
|
||||||
|
@ -1697,10 +1697,10 @@ static struct Packet *ssh1_pkt_init(int pkt_type)
|
||||||
static struct Packet *ssh2_pkt_init(int pkt_type)
|
static struct Packet *ssh2_pkt_init(int pkt_type)
|
||||||
{
|
{
|
||||||
struct Packet *pkt = ssh_new_packet();
|
struct Packet *pkt = ssh_new_packet();
|
||||||
pkt->length = 5;
|
pkt->length = 5; /* space for packet length + padding length */
|
||||||
pkt->forcepad = 0;
|
pkt->forcepad = 0;
|
||||||
ssh_pkt_addbyte(pkt, (unsigned char) pkt_type);
|
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;
|
return pkt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче