From 186116ce9a312929656fb977e57ec49aaee099c2 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Thu, 8 Dec 2022 15:08:14 +0100 Subject: various: fix unitialized local variables Reported by: GitHub CodeQL Code scanning alerts: 214, 215, 216 --- libarchive/archive_read_support_format_iso9660.c | 2 +- libarchive/archive_string.c | 6 +++--- libarchive/archive_write_disk_posix.c | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index cd7f92f4..33bf330c 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -1757,7 +1757,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent, size_t name_len; const unsigned char *rr_start, *rr_end; const unsigned char *p; - size_t dr_len; + size_t dr_len = 0; uint64_t fsize, offset; int32_t location; int flags; diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index d7f2c46b..69458e1a 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -3988,10 +3988,10 @@ int archive_mstring_get_mbs_l(struct archive *a, struct archive_mstring *aes, const char **p, size_t *length, struct archive_string_conv *sc) { - int r, ret = 0; - - (void)r; /* UNUSED */ + int ret = 0; #if defined(_WIN32) && !defined(__CYGWIN__) + int r; + /* * Internationalization programming on Windows must use Wide * characters because Windows platform cannot make locale UTF-8. diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index 4793878b..09a5eef0 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -2795,7 +2795,7 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr, char *tail; char *head; int last; - char c; + char c = '\0'; int r; struct stat st; int chdir_fd; -- cgit v1.2.1