mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Security improvement: check that string length field in
SSH_SMSG_{STDOUT,STDERR}_DATA packets is consistent with length field in packet header. (Helps prevent insertion attack.) [originally from svn r496]
This commit is contained in:
parent
e0fac426c5
commit
0793be4efe
6
ssh.c
6
ssh.c
@ -665,7 +665,11 @@ static void ssh_protocol(unsigned char *in, int inlen, int ispkt) {
|
||||
long len = 0;
|
||||
for (i = 0; i < 4; i++)
|
||||
len = (len << 8) + pktin.body[i];
|
||||
c_write(pktin.body+4, len);
|
||||
if (len+4 != pktin.length) {
|
||||
logevent("Received data packet with bogus string length"
|
||||
", ignoring");
|
||||
} else
|
||||
c_write(pktin.body+4, len);
|
||||
} else if (pktin.type == SSH_MSG_DISCONNECT) {
|
||||
ssh_state = SSH_STATE_CLOSED;
|
||||
logevent("Received disconnect request");
|
||||
|
Loading…
Reference in New Issue
Block a user