VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_source_file_common.c
diff options
context:
space:
mode:
authorDLL125 <134442578+DLL125@users.noreply.github.com>2023-07-17 14:11:12 +0200
committerGitHub <noreply@github.com>2023-07-17 14:11:12 +0200
commit65765798d85258c0358b28b90aac68ed1851f49b (patch)
tree22f573edc4e16790d9be208fce95db1134fe2ba4 /src/Common/libzip/zip_source_file_common.c
parent6267b91931af87db2b95172389a6fbaac206e42e (diff)
downloadVeraCrypt-65765798d85258c0358b28b90aac68ed1851f49b.tar.gz
VeraCrypt-65765798d85258c0358b28b90aac68ed1851f49b.zip
Libzip (#1152)
* Update LZMA to latest * Update Libzip Libzip updated to latest.
Diffstat (limited to 'src/Common/libzip/zip_source_file_common.c')
-rw-r--r--src/Common/libzip/zip_source_file_common.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/Common/libzip/zip_source_file_common.c b/src/Common/libzip/zip_source_file_common.c
index e92a43b3..a2a46a44 100644
--- a/src/Common/libzip/zip_source_file_common.c
+++ b/src/Common/libzip/zip_source_file_common.c
@@ -109,7 +109,7 @@ zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zi
ctx->start = start;
ctx->len = (zip_uint64_t)len;
if (st) {
- memcpy(&ctx->st, st, sizeof(ctx->st));
+ (void)memcpy_s(&ctx->st, sizeof(ctx->st), st, sizeof(*st));
ctx->st.name = NULL;
ctx->st.valid &= ~ZIP_STAT_NAME;
}
@@ -130,7 +130,7 @@ zip_source_file_common_new(const char *fname, void *file, zip_uint64_t start, zi
zip_error_init(&ctx->error);
zip_file_attributes_init(&ctx->attributes);
- ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, -1);
+ ctx->supports = ZIP_SOURCE_SUPPORTS_READABLE | zip_source_make_command_bitmap(ZIP_SOURCE_SUPPORTS, ZIP_SOURCE_TELL, ZIP_SOURCE_SUPPORTS_REOPEN, -1);
zip_source_file_stat_init(&sb);
if (!ops->stat(ctx, &sb)) {
@@ -262,7 +262,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
zip_error_set(&ctx->error, ZIP_ER_INVAL, 0);
return -1;
}
- memcpy(data, &ctx->attributes, sizeof(ctx->attributes));
+ (void)memcpy_s(data, sizeof(ctx->attributes), &ctx->attributes, sizeof(ctx->attributes));
return sizeof(ctx->attributes);
case ZIP_SOURCE_OPEN:
@@ -272,7 +272,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
}
}
- if (ctx->start > 0) { // TODO: rewind on re-open
+ if (ctx->start > 0) { /* TODO: rewind on re-open */
if (ctx->ops->seek(ctx, ctx->f, (zip_int64_t)ctx->start, SEEK_SET) == false) {
/* TODO: skip by reading */
return -1;
@@ -355,7 +355,7 @@ read_file(void *state, void *data, zip_uint64_t len, zip_source_cmd_t cmd) {
return -1;
}
- memcpy(data, &ctx->st, sizeof(ctx->st));
+ (void)memcpy_s(data, sizeof(ctx->st), &ctx->st, sizeof(ctx->st));
return sizeof(ctx->st);
}