summaryrefslogtreecommitdiff
path: root/zlib/inflate.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2019-03-16 09:52:30 -0700
committerWayne Davison <wayned@samba.org>2019-03-16 09:56:11 -0700
commit8eb50bce43634b9ef9ae940778ac08a959a7e8e4 (patch)
treeeeebdd5bab67673d9c3b8ac94a6f9a0b66b47a1f /zlib/inflate.c
parentfc10fafa252ae1055296831506e6e2dcdc1853c5 (diff)
downloadrsync-8eb50bce43634b9ef9ae940778ac08a959a7e8e4.tar.gz
Fix zlib CVE-2016-9842.
Diffstat (limited to 'zlib/inflate.c')
-rw-r--r--zlib/inflate.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/zlib/inflate.c b/zlib/inflate.c
index 5ed2390d..e43abd9e 100644
--- a/zlib/inflate.c
+++ b/zlib/inflate.c
@@ -1526,9 +1526,10 @@ z_streamp strm;
{
struct inflate_state FAR *state;
- if (strm == Z_NULL || strm->state == Z_NULL) return -(1L << 16);
+ if (strm == Z_NULL || strm->state == Z_NULL)
+ return (long)(((unsigned long)0 - 1) << 16);
state = (struct inflate_state FAR *)strm->state;
- return ((long)(state->back) << 16) +
+ return (long)(((unsigned long)((long)state->back)) << 16) +
(state->mode == COPY ? state->length :
(state->mode == MATCH ? state->was - state->length : 0));
}