Added zer bytes compression protection

This commit is contained in:
Michiel Broek 2005-01-17 20:01:03 +00:00
parent c4abc58d12
commit c02c520c16
2 changed files with 7 additions and 1 deletions

View File

@ -3,6 +3,12 @@ $Id$
v0.71.2 16-Jan-2005
mbcico:
Added protection during binkp receive for zero bytes compressed
data frames, this will case uncompress error -5 because zero
bytes can't be compressed ar all.
v0.71.1 28-Nov-2004 - 16-Jan-2005
porting:

View File

@ -1963,7 +1963,7 @@ int binkp_poll_frame(void)
if ((bp.rxlen == (bp.blklen + 1) && (bp.rxlen >= 1))) {
bp.GotFrame = TRUE;
#ifdef HAVE_ZLIB_H
if ((bp.PLZflag == Active) && (bp.header & BINKP_PLZ_BLOCK)) {
if ((bp.PLZflag == Active) && (bp.header & BINKP_PLZ_BLOCK) && bp.blklen) {
zbuf = calloc(BINKP_ZIPBUFLEN, sizeof(char));
zlen = BINKP_PLZ_BLOCK -1;
rc = uncompress(zbuf, &zlen, bp.rxbuf, bp.rxlen -1);