VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_dir_add.c
diff options
context:
space:
mode:
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';
}