You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.8 KiB

  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. The external minizip project has changed the unzGetCurrentFileInfo()
  10. function to take a uint16_t as the filename size, instead of a uLong
  11. as in the original version in zlib.
  12. (Reported as https://github.com/nmoinvaz/minizip/issues/490 but it
  13. was 3½ years ago and might be too late to fix it now, although changing
  14. it back to a *larger* type is a lot safer than reducing the size, and
  15. perhaps they should.)
  16. This means that our 65536-byte buffer gets truncated to zero, as the
  17. compiler tells us when we build agaisnt the external minizip:
  18. 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]
  19. 140 | unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
  20. | ^~~~~~~~~~~~
  21. Reduce the buffer size to 65535 bytes instead.
  22. ---
  23. main/unzip_stream.h | 2 +-
  24. 1 file changed, 1 insertion(+), 1 deletion(-)
  25. diff --git a/main/unzip_stream.h b/main/unzip_stream.h
  26. index 136fcefd9..813f2489a 100644
  27. --- a/main/unzip_stream.h
  28. +++ b/main/unzip_stream.h
  29. @@ -135,7 +135,7 @@ namespace clx {
  30. basic_unzip_stream& open(handler_type h) {
  31. handler_ = h;
  32. if (handler_) {
  33. - char path[65536];
  34. + char path[65535];
  35. unz_file_info info;
  36. unzGetCurrentFileInfo(handler_, &info, path, sizeof(path), NULL, 0, NULL, 0);
  37. path_ = path;
  38. --
  39. 2.26.2