From cd7a01c34fc4304ef8161ee617568f274ace5d24 Mon Sep 17 00:00:00 2001 From: Mounir IDRASSI Date: Sun, 18 Mar 2018 23:13:40 +0100 Subject: Windows: Update libzip to version 1.5.0 that include fixes for some security issues. --- src/Common/libzip/zip_io_util.c | 50 +++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 27 deletions(-) (limited to 'src/Common/libzip/zip_io_util.c') diff --git a/src/Common/libzip/zip_io_util.c b/src/Common/libzip/zip_io_util.c index 53a5dd26..77be8f06 100644 --- a/src/Common/libzip/zip_io_util.c +++ b/src/Common/libzip/zip_io_util.c @@ -1,10 +1,10 @@ /* zip_io_util.c -- I/O helper functions Copyright (C) 1999-2016 Dieter Baron and Thomas Klausner - + This file is part of libzip, a library to manipulate ZIP archives. The authors can be contacted at - + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -17,7 +17,7 @@ 3. The names of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. - + THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -37,8 +37,7 @@ #include "zipint.h" int -_zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *error) -{ +_zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *error) { zip_int64_t n; if (length > ZIP_INT64_MAX) { @@ -61,10 +60,9 @@ _zip_read(zip_source_t *src, zip_uint8_t *b, zip_uint64_t length, zip_error_t *e zip_uint8_t * -_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error) -{ +_zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp, zip_error_t *error) { zip_uint8_t *r; - + if (length == 0 && !nulp) { return NULL; } @@ -76,13 +74,13 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp } if (buffer) { - zip_uint8_t *data = _zip_buffer_get(buffer, length); - - if (data == NULL) { - zip_error_set(error, ZIP_ER_MEMORY, 0); - free(r); - return NULL; - } + zip_uint8_t *data = _zip_buffer_get(buffer, length); + + if (data == NULL) { + zip_error_set(error, ZIP_ER_MEMORY, 0); + free(r); + return NULL; + } memcpy(r, data, length); } else { @@ -96,7 +94,7 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp zip_uint8_t *o; /* replace any in-string NUL characters with spaces */ r[length] = 0; - for (o=r; osrc, data, length)) < 0) { - _zip_error_set_from_source(&za->error, za->src); - return -1; + _zip_error_set_from_source(&za->error, za->src); + return -1; } if ((zip_uint64_t)n != length) { - zip_error_set(&za->error, ZIP_ER_WRITE, EINTR); - return -1; + zip_error_set(&za->error, ZIP_ER_WRITE, EINTR); + return -1; } - + return 0; } -- cgit v1.2.3