VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_dir_add.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_dir_add.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_dir_add.c')
-rw-r--r--src/Common/libzip/zip_dir_add.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Common/libzip/zip_dir_add.c b/src/Common/libzip/zip_dir_add.c
index 42ba5e84..c0108191 100644
--- a/src/Common/libzip/zip_dir_add.c
+++ b/src/Common/libzip/zip_dir_add.c
@@ -61,11 +61,11 @@ zip_dir_add(zip_t *za, const char *name, zip_flags_t flags) {
len = strlen(name);
if (name[len - 1] != '/') {
- if ((s = (char *)malloc(len + 2)) == NULL) {
+ if (len > SIZE_MAX - 2 || (s = (char *)malloc(len + 2)) == NULL) {
zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
return -1;
}
- strcpy(s, name);
+ (void)strncpy_s(s, len + 2, name, len);
s[len] = '/';
s[len + 1] = '\0';
}