- don't try to allocate negative size
[m6w6/ext-http] / http_encoding_api.c
index a8d3ec0e048c6a6e96f97d5c3bdc3e1186734c03..4d08e71c2c2bf5e582e74b0ae31c0dd33512489c 100644 (file)
@@ -261,6 +261,11 @@ inline STATUS http_verify_gzencode_buffer(const char *data, size_t data_len, con
                }
        }
        
                }
        }
        
+       if (data_len < offset + 8) {
+               http_error(error_level TSRMLS_CC, HTTP_E_ENCODING, "Missing or truncated GZIP footer");
+               return FAILURE;
+       }
+       
        if (encoded) {
                *encoded = data + offset;
        }
        if (encoded) {
                *encoded = data + offset;
        }