File CVE-2017-14502.patch of Package libarchive.13055
commit 5562545b5562f6d12a4ef991fae158bf4ccf92b6
Author: Joerg Sonnenberger <joerg@bec.de>
Date: Sat Sep 9 17:47:32 2017 +0200
Avoid a read off-by-one error for UTF16 names in RAR archives.
Reported-By: OSS-Fuzz issue 573
Index: libarchive-3.1.2/libarchive/archive_read_support_format_rar.c
===================================================================
--- libarchive-3.1.2.orig/libarchive/archive_read_support_format_rar.c
+++ libarchive-3.1.2/libarchive/archive_read_support_format_rar.c
@@ -1421,7 +1421,11 @@ read_header(struct archive_read *a, stru
return (ARCHIVE_FATAL);
}
filename[filename_size++] = '\0';
- filename[filename_size++] = '\0';
+ /*
+ * Do not increment filename_size here as the computations below
+ * add the space for the terminating NUL explicitly.
+ */
+ filename[filename_size] = '\0';
/* Decoded unicode form is UTF-16BE, so we have to update a string
* conversion object for it. */