]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Check size of the extended time field in zip archives
authorJoerg Sonnenberger <joerg@bec.de>
Sat, 31 Mar 2018 20:48:25 +0000 (22:48 +0200)
committerJoerg Sonnenberger <joerg@bec.de>
Sat, 31 Mar 2018 20:48:25 +0000 (22:48 +0200)
Reported-By: OSS-Fuzz issue 4969
libarchive/archive_read_support_format_zip.c

index 784160070ddebbdfd0d0f62b23d61bd2f9d02ea5..18f0d04e5c4e3d9617f3d6d7b569b596327b4136 100644 (file)
@@ -511,7 +511,13 @@ process_extra(struct archive_read *a, const char *p, size_t extra_length, struct
                case 0x5455:
                {
                        /* Extended time field "UT". */
-                       int flags = p[offset];
+                       int flags;
+                       if (datasize == 0) {
+                               archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+                                   "Incomplete extended time field");
+                               return ARCHIVE_FAILED;
+                       }
+                       flags = p[offset];
                        offset++;
                        datasize--;
                        /* Flag bits indicate which dates are present. */