VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src/Common/libzip/zip_name_locate.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_name_locate.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_name_locate.c')
-rw-r--r--src/Common/libzip/zip_name_locate.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/Common/libzip/zip_name_locate.c b/src/Common/libzip/zip_name_locate.c
index 806053cc..4248dc2d 100644
--- a/src/Common/libzip/zip_name_locate.c
+++ b/src/Common/libzip/zip_name_locate.c
@@ -49,20 +49,29 @@ zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags) {
zip_int64_t
_zip_name_locate(zip_t *za, const char *fname, zip_flags_t flags, zip_error_t *error) {
int (*cmp)(const char *, const char *);
+ size_t fname_length;
zip_string_t *str = NULL;
const char *fn, *p;
zip_uint64_t i;
- if (za == NULL)
+ if (za == NULL) {
return -1;
+ }
if (fname == NULL) {
zip_error_set(error, ZIP_ER_INVAL, 0);
return -1;
}
+ fname_length = strlen(fname);
+
+ if (fname_length > ZIP_UINT16_MAX) {
+ zip_error_set(error, ZIP_ER_INVAL, 0);
+ return -1;
+ }
+
if ((flags & (ZIP_FL_ENC_UTF_8 | ZIP_FL_ENC_RAW)) == 0 && fname[0] != '\0') {
- if ((str = _zip_string_new((const zip_uint8_t *)fname, strlen(fname), flags, error)) == NULL) {
+ if ((str = _zip_string_new((const zip_uint8_t *)fname, (zip_uint16_t)strlen(fname), flags, error)) == NULL) {
return -1;
}
if ((fname = (const char *)_zip_string_get(str, NULL, 0, error)) == NULL) {