VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_file_replace.c
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2018-03-18 23:13:40 +0100
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2018-03-18 23:13:40 +0100
commitcd7a01c34fc4304ef8161ee617568f274ace5d24 (patch)
tree41ed56e75a5feedc5f7d4fedb6338569d54d6076 /src/Common/libzip/zip_file_replace.c
parent49a8e52139b960afd3913053380190cf2d03ceda (diff)
downloadVeraCrypt-cd7a01c34fc4304ef8161ee617568f274ace5d24.tar.gz
VeraCrypt-cd7a01c34fc4304ef8161ee617568f274ace5d24.zip
Windows: Update libzip to version 1.5.0 that include fixes for some security issues.
Diffstat (limited to 'src/Common/libzip/zip_file_replace.c')
-rw-r--r--src/Common/libzip/zip_file_replace.c41
1 files changed, 19 insertions, 22 deletions
diff --git a/src/Common/libzip/zip_file_replace.c b/src/Common/libzip/zip_file_replace.c
index e430efae..e42f5cd9 100644
--- a/src/Common/libzip/zip_file_replace.c
+++ b/src/Common/libzip/zip_file_replace.c
@@ -19,3 +19,3 @@
written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
@@ -38,4 +38,3 @@
ZIP_EXTERN int
-zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t flags)
-{
+zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t flags) {
if (idx >= za->nentry || source == NULL) {
@@ -52,3 +51,2 @@ zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t
-
/* NOTE: Signed due to -1 on error. See zip_add.c for more details. */
@@ -56,6 +54,5 @@ zip_file_replace(zip_t *za, zip_uint64_t idx, zip_source_t *source, zip_flags_t
zip_int64_t
-_zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *source, zip_flags_t flags)
-{
+_zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *source, zip_flags_t flags) {
zip_uint64_t za_nentry_prev;
-
+
if (ZIP_IS_RDONLY(za)) {
@@ -68,3 +65,3 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
zip_int64_t i = -1;
-
+
if (flags & ZIP_FL_OVERWRITE)
@@ -74,3 +71,3 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
/* create and use new entry, used by zip_add */
- if ((i=_zip_add_entry(za)) < 0)
+ if ((i = _zip_add_entry(za)) < 0)
return -1;
@@ -79,6 +76,6 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
}
-
+
if (name && _zip_set_name(za, idx, name, flags) != 0) {
if (za->nentry != za_nentry_prev) {
- _zip_entry_finalize(za->entry+idx);
+ _zip_entry_finalize(za->entry + idx);
za->nentry = za_nentry_prev;
@@ -90,16 +87,16 @@ _zip_file_replace(zip_t *za, zip_uint64_t idx, const char *name, zip_source_t *s
* needed for a double add of the same file name */
- _zip_unchange_data(za->entry+idx);
+ _zip_unchange_data(za->entry + idx);
if (za->entry[idx].orig != NULL && (za->entry[idx].changes == NULL || (za->entry[idx].changes->changed & ZIP_DIRENT_COMP_METHOD) == 0)) {
- if (za->entry[idx].changes == NULL) {
- if ((za->entry[idx].changes=_zip_dirent_clone(za->entry[idx].orig)) == NULL) {
- zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
- return -1;
- }
- }
-
- za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT;
- za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD;
+ if (za->entry[idx].changes == NULL) {
+ if ((za->entry[idx].changes = _zip_dirent_clone(za->entry[idx].orig)) == NULL) {
+ zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
+ return -1;
+ }
+ }
+
+ za->entry[idx].changes->comp_method = ZIP_CM_REPLACED_DEFAULT;
+ za->entry[idx].changes->changed |= ZIP_DIRENT_COMP_METHOD;
}
-
+
za->entry[idx].source = source;