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