mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-03 04:22:47 -05:00
Fix a segfault (non-security-critical - null dereference for
reading) in the zlib code when fed certain kinds of invalid data. As a result, ssh.c now needs to be prepared for zlib_decompress_block to return failure. [originally from svn r3306]
This commit is contained in:
9
ssh.c
9
ssh.c
@ -868,9 +868,12 @@ static int ssh1_rdpkt(Ssh ssh, unsigned char **data, int *datalen)
|
||||
if (ssh->v1_compressing) {
|
||||
unsigned char *decompblk;
|
||||
int decomplen;
|
||||
zlib_decompress_block(ssh->sc_comp_ctx,
|
||||
ssh->pktin.body - 1, ssh->pktin.length + 1,
|
||||
&decompblk, &decomplen);
|
||||
if (!zlib_decompress_block(ssh->sc_comp_ctx,
|
||||
ssh->pktin.body - 1, ssh->pktin.length + 1,
|
||||
&decompblk, &decomplen)) {
|
||||
bombout(("Zlib decompression encountered invalid data"));
|
||||
crStop(0);
|
||||
}
|
||||
|
||||
if (ssh->pktin.maxlen < st->pad + decomplen) {
|
||||
ssh->pktin.maxlen = st->pad + decomplen;
|
||||
|
Reference in New Issue
Block a user