blob: 570ebfc68d356179ae8824ad13eff1012fc50c3f [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From 3c23a7863c0b01273d4c36423769443ea7e4a7bb Mon Sep 17 00:00:00 2001
2From: David Woodhouse <dwmw2@infradead.org>
3Date: Fri, 5 Jun 2020 15:02:41 +0100
4Subject: [PATCH 1/2] unzip: reduce file name size to 65535 to work with
5 external minizip
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10The external minizip project has changed the unzGetCurrentFileInfo()
11function to take a uint16_t as the filename size, instead of a uLong
12as in the original version in zlib.
13
14(Reported as https://github.com/nmoinvaz/minizip/issues/490 but it
15was 3½ years ago and might be too late to fix it now, although changing
16it back to a *larger* type is a lot safer than reducing the size, and
17perhaps they should.)
18
19This means that our 65536-byte buffer gets truncated to zero, as the
20compiler tells us when we build agaisnt the external minizip:
21
22domoticz/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
26Reduce the buffer size to 65535 bytes instead.
27---
28 main/unzip_stream.h | 2 +-
29 1 file changed, 1 insertion(+), 1 deletion(-)
30
31--- a/main/unzip_stream.h
32+++ b/main/unzip_stream.h
33@@ -143,7 +143,7 @@ namespace clx {
34 basic_unzip_stream& open(handler_type h) {
35 handler_ = h;
36 if (handler_) {
37- char path[65536];
38+ char path[65535];
39 unz_file_info info;
40 unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
41 path_ = path;