]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
various: fix unitialized local variables
authorMartin Matuska <martin@matuska.de>
Thu, 8 Dec 2022 14:08:14 +0000 (15:08 +0100)
committerMartin Matuska <martin@matuska.de>
Thu, 8 Dec 2022 14:08:14 +0000 (15:08 +0100)
Reported by: GitHub CodeQL
Code scanning alerts: 214, 215, 216

libarchive/archive_read_support_format_iso9660.c
libarchive/archive_string.c
libarchive/archive_write_disk_posix.c

index cd7f92f464d66f77fd3dd580c659d4064ff88ec5..33bf330cbfe4001e274f9d70df706165bf5b9705 100644 (file)
@@ -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;
index d7f2c46b28fe4eeca20fb5af1b7e655059979db9..69458e1a12b1d39105fd487eb68d75e024a781f8 100644 (file)
@@ -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.
index 4793878bf72fa81bf59f7adb83b346a66bd6675a..09a5eef03dab0e1d28391156fbc9acbec8f92cf0 100644 (file)
@@ -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;