aboutsummaryrefslogtreecommitdiff
path: root/contrib/minizip/zip.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/minizip/zip.c')
-rw-r--r--contrib/minizip/zip.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/contrib/minizip/zip.c b/contrib/minizip/zip.c
index cbb2508..93d2612 100644
--- a/contrib/minizip/zip.c
+++ b/contrib/minizip/zip.c
@@ -25,8 +25,10 @@
25#include <stdio.h> 25#include <stdio.h>
26#include <stdlib.h> 26#include <stdlib.h>
27#include <string.h> 27#include <string.h>
28#include <stdint.h>
29#include <time.h> 28#include <time.h>
29#ifndef ZLIB_CONST
30# define ZLIB_CONST
31#endif
30#include "zlib.h" 32#include "zlib.h"
31#include "zip.h" 33#include "zip.h"
32 34
@@ -125,9 +127,9 @@ typedef struct linkedlist_data_s
125 127
126// zipAlreadyThere() set functions for a set of zero-terminated strings, and 128// zipAlreadyThere() set functions for a set of zero-terminated strings, and
127// a block_t type for reading the central directory datablocks. 129// a block_t type for reading the central directory datablocks.
128typedef char const *set_key_t; 130typedef char *set_key_t;
129#define set_cmp(a, b) strcmp(a, b) 131#define set_cmp(a, b) strcmp(a, b)
130#define set_drop(s, k) set_free(s, (void *)(intptr_t)(k)) 132#define set_drop(s, k) set_free(s, k)
131#include "skipset.h" 133#include "skipset.h"
132typedef struct { 134typedef struct {
133 unsigned char *next; // next byte in datablock data 135 unsigned char *next; // next byte in datablock data
@@ -496,7 +498,12 @@ extern int ZEXPORT zipAlreadyThere(zipFile file, char const *name) {
496 } 498 }
497 499
498 // Return true if name is in the central directory. 500 // Return true if name is in the central directory.
499 return set_found(&zip->set, name); 501 size_t len = strlen(name);
502 char *copy = set_alloc(&zip->set, NULL, len + 1);
503 strcpy(copy, name);
504 int found = set_found(&zip->set, copy);
505 set_free(&zip->set, copy);
506 return found;
500} 507}
501 508
502 509
@@ -1646,7 +1653,7 @@ extern int ZEXPORT zipWriteInFileInZip(zipFile file, const void* buf, unsigned i
1646 else 1653 else
1647#endif 1654#endif
1648 { 1655 {
1649 zi->ci.stream.next_in = (Bytef*)(uintptr_t)buf; 1656 zi->ci.stream.next_in = buf;
1650 zi->ci.stream.avail_in = len; 1657 zi->ci.stream.avail_in = len;
1651 1658
1652 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0)) 1659 while ((err==ZIP_OK) && (zi->ci.stream.avail_in>0))