summaryrefslogtreecommitdiffstats
path: root/src/crypto
diff options
context:
space:
mode:
authorMichael Brown2014-01-08 23:21:23 +0100
committerMichael Brown2014-01-12 22:53:10 +0100
commit97fd5ccdd86f4c84b128e905c663b2bd7e6397fe (patch)
treef345f664066e7681b1166acb7c1ba1a74188499f /src/crypto
parent[deflate] Add support for DEFLATE decompression (diff)
downloadipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.tar.gz
ipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.tar.xz
ipxe-97fd5ccdd86f4c84b128e905c663b2bd7e6397fe.zip
[deflate] Fix literal data length calculation
Fix incorrect calculation used to determine length of data to be copied within a literal data block, and add a test case to prevent this bug from going undetected in future. Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/deflate.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/crypto/deflate.c b/src/crypto/deflate.c
index 1854eff4..91a48996 100644
--- a/src/crypto/deflate.c
+++ b/src/crypto/deflate.c
@@ -609,7 +609,7 @@ int deflate_inflate ( struct deflate *deflate,
/* Calculate available amount of literal data */
in_remaining = ( in->len - in->offset );
len = deflate->remaining;
- if ( len < in_remaining )
+ if ( len > in_remaining )
len = in_remaining;
/* Copy data to output buffer */