Merge pull request #12342 from PolynomialDivision/feature/add_dawn_node_exporter
[feed/packages.git] / utils / domoticz / patches / 012-minizip-overflow.patch
1 From 3c23a7863c0b01273d4c36423769443ea7e4a7bb Mon Sep 17 00:00:00 2001
2 From: David Woodhouse <dwmw2@infradead.org>
3 Date: Fri, 5 Jun 2020 15:02:41 +0100
4 Subject: [PATCH 1/2] unzip: reduce file name size to 65535 to work with
5 external minizip
6 MIME-Version: 1.0
7 Content-Type: text/plain; charset=UTF-8
8 Content-Transfer-Encoding: 8bit
9
10 The external minizip project has changed the unzGetCurrentFileInfo()
11 function to take a uint16_t as the filename size, instead of a uLong
12 as in the original version in zlib.
13
14 (Reported as https://github.com/nmoinvaz/minizip/issues/490 but it
15 was 3½ years ago and might be too late to fix it now, although changing
16 it back to a *larger* type is a lot safer than reducing the size, and
17 perhaps they should.)
18
19 This means that our 65536-byte buffer gets truncated to zero, as the
20 compiler tells us when we build agaisnt the external minizip:
21
22 domoticz/main/unzip_stream.h:140:50: warning: conversion from ‘long unsigned int’ to ‘uint16_t’ {aka ‘short unsigned int’} changes value from ‘65536’ to ‘0’ [-Woverflow]
23 140 | unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
24 | ^~~~~~~~~~~~
25
26 Reduce the buffer size to 65535 bytes instead.
27 ---
28 main/unzip_stream.h | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31 diff --git a/main/unzip_stream.h b/main/unzip_stream.h
32 index 136fcefd9..813f2489a 100644
33 --- a/main/unzip_stream.h
34 +++ b/main/unzip_stream.h
35 @@ -135,7 +135,7 @@ namespace clx {
36 basic_unzip_stream& open(handler_type h) {
37 handler_ = h;
38 if (handler_) {
39 - char path[65536];
40 + char path[65535];
41 unz_file_info info;
42 unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
43 path_ = path;
44 --
45 2.26.2
46