mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2025-11-13 11:58:26 -06:00
Windows: Update libzip to version 1.5.0 that include fixes for some security issues.
This commit is contained in:
@@ -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 <libzip@nih.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; o<r+length; o++)
|
||||
for (o = r; o < r + length; o++)
|
||||
if (*o == '\0')
|
||||
*o = ' ';
|
||||
}
|
||||
@@ -106,12 +104,11 @@ _zip_read_data(zip_buffer_t *buffer, zip_source_t *src, size_t length, bool nulp
|
||||
|
||||
|
||||
zip_string_t *
|
||||
_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool nulp, zip_error_t *error)
|
||||
{
|
||||
_zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool nulp, zip_error_t *error) {
|
||||
zip_uint8_t *raw;
|
||||
zip_string_t *s;
|
||||
|
||||
if ((raw=_zip_read_data(buffer, src, len, nulp, error)) == NULL)
|
||||
if ((raw = _zip_read_data(buffer, src, len, nulp, error)) == NULL)
|
||||
return NULL;
|
||||
|
||||
s = _zip_string_new(raw, len, ZIP_FL_ENC_GUESS, error);
|
||||
@@ -121,18 +118,17 @@ _zip_read_string(zip_buffer_t *buffer, zip_source_t *src, zip_uint16_t len, bool
|
||||
|
||||
|
||||
int
|
||||
_zip_write(zip_t *za, const void *data, zip_uint64_t length)
|
||||
{
|
||||
_zip_write(zip_t *za, const void *data, zip_uint64_t length) {
|
||||
zip_int64_t n;
|
||||
|
||||
|
||||
if ((n = zip_source_write(za->src, 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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user