diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2018-03-18 23:13:40 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2018-03-18 23:13:40 +0100 |
commit | cd7a01c34fc4304ef8161ee617568f274ace5d24 (patch) | |
tree | 41ed56e75a5feedc5f7d4fedb6338569d54d6076 /src/Common/libzip/zip_string.c | |
parent | 49a8e52139b960afd3913053380190cf2d03ceda (diff) | |
download | VeraCrypt-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_string.c')
-rw-r--r-- | src/Common/libzip/zip_string.c | 48 |
1 files changed, 19 insertions, 29 deletions
diff --git a/src/Common/libzip/zip_string.c b/src/Common/libzip/zip_string.c index 307a425f..293766c1 100644 --- a/src/Common/libzip/zip_string.c +++ b/src/Common/libzip/zip_string.c @@ -19,3 +19,3 @@ written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS @@ -41,9 +41,8 @@ zip_uint32_t -_zip_string_crc32(const zip_string_t *s) -{ +_zip_string_crc32(const zip_string_t *s) { zip_uint32_t crc; - + crc = (zip_uint32_t)crc32(0L, Z_NULL, 0); - if (s != NULL) + if (s != NULL) crc = (zip_uint32_t)crc32(crc, s->raw, s->length); @@ -55,4 +54,3 @@ _zip_string_crc32(const zip_string_t *s) int -_zip_string_equal(const zip_string_t *a, const zip_string_t *b) -{ +_zip_string_equal(const zip_string_t *a, const zip_string_t *b) { if (a == NULL || b == NULL) @@ -70,4 +68,3 @@ _zip_string_equal(const zip_string_t *a, const zip_string_t *b) void -_zip_string_free(zip_string_t *s) -{ +_zip_string_free(zip_string_t *s) { if (s == NULL) @@ -82,4 +79,3 @@ _zip_string_free(zip_string_t *s) const zip_uint8_t * -_zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error) -{ +_zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip_error_t *error) { static const zip_uint8_t empty[1] = ""; @@ -97,8 +93,5 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip - if (((flags & ZIP_FL_ENC_STRICT) - && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) - || (string->encoding == ZIP_ENCODING_CP437)) { + if (((flags & ZIP_FL_ENC_STRICT) && string->encoding != ZIP_ENCODING_ASCII && string->encoding != ZIP_ENCODING_UTF8_KNOWN) || (string->encoding == ZIP_ENCODING_CP437)) { if (string->converted == NULL) { - if ((string->converted=_zip_cp437_to_utf8(string->raw, string->length, - &string->converted_length, error)) == NULL) + if ((string->converted = _zip_cp437_to_utf8(string->raw, string->length, &string->converted_length, error)) == NULL) return NULL; @@ -110,3 +103,3 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip } - + if (lenp) @@ -118,4 +111,3 @@ _zip_string_get(zip_string_t *string, zip_uint32_t *lenp, zip_flags_t flags, zip zip_uint16_t -_zip_string_length(const zip_string_t *s) -{ +_zip_string_length(const zip_string_t *s) { if (s == NULL) @@ -128,7 +120,6 @@ _zip_string_length(const zip_string_t *s) zip_string_t * -_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error) -{ +_zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, zip_error_t *error) { zip_string_t *s; zip_encoding_type_t expected_encoding; - + if (length == 0) @@ -150,4 +141,4 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, } - - if ((s=(zip_string_t *)malloc(sizeof(*s))) == NULL) { + + if ((s = (zip_string_t *)malloc(sizeof(*s))) == NULL) { zip_error_set(error, ZIP_ER_MEMORY, 0); @@ -156,3 +147,3 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, - if ((s->raw=(zip_uint8_t *)malloc((size_t)(length+1))) == NULL) { + if ((s->raw = (zip_uint8_t *)malloc((size_t)(length + 1))) == NULL) { free(s); @@ -175,3 +166,3 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, } - + return s; @@ -181,7 +172,6 @@ _zip_string_new(const zip_uint8_t *raw, zip_uint16_t length, zip_flags_t flags, int -_zip_string_write(zip_t *za, const zip_string_t *s) -{ +_zip_string_write(zip_t *za, const zip_string_t *s) { if (s == NULL) return 0; - + return _zip_write(za, s->raw, s->length); |