summaryrefslogtreecommitdiff
path: root/libz/libz/CVE-2022-37434-1eb7682.patch
blob: b37103609f256f573cc7d82ec9826520d4c05981 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
:100644 100644 7a728974923a43306eff24fc5d84191cd7b92cf2 2a3c4fe9846406c15a4bbd02e7fe6907589e1670 M	inflate.c

diff --git a/inflate.c b/inflate.c
index 7a72897..2a3c4fe 100644
--- a/inflate.c
+++ b/inflate.c
@@ -763,10 +763,10 @@ int flush;
                 copy = state->length;
                 if (copy > have) copy = have;
                 if (copy) {
-                    len = state->head->extra_len - state->length;
                     if (state->head != Z_NULL &&
                         state->head->extra != Z_NULL &&
-                        len < state->head->extra_max) {
+                        (len = state->head->extra_len - state->length) <
+                            state->head->extra_max) {
                         zmemcpy(state->head->extra + len, next,
                                 len + copy > state->head->extra_max ?
                                 state->head->extra_max - len : copy);