Commit | Line | Data |
---|---|---|
2a0e3d16 LF |
1 | Fix CVE-2017-14502: |
2 | ||
3 | https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-14502 | |
4 | https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=573 | |
5 | ||
6 | Patch copied from upstream source repository: | |
7 | ||
8 | https://github.com/libarchive/libarchive/commit/5562545b5562f6d12a4ef991fae158bf4ccf92b6 | |
9 | ||
10 | From 5562545b5562f6d12a4ef991fae158bf4ccf92b6 Mon Sep 17 00:00:00 2001 | |
11 | From: Joerg Sonnenberger <joerg@bec.de> | |
12 | Date: Sat, 9 Sep 2017 17:47:32 +0200 | |
13 | Subject: [PATCH] Avoid a read off-by-one error for UTF16 names in RAR | |
14 | archives. | |
15 | ||
16 | Reported-By: OSS-Fuzz issue 573 | |
17 | --- | |
18 | libarchive/archive_read_support_format_rar.c | 6 +++++- | |
19 | 1 file changed, 5 insertions(+), 1 deletion(-) | |
20 | ||
21 | diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c | |
22 | index cbb14c32..751de697 100644 | |
23 | --- a/libarchive/archive_read_support_format_rar.c | |
24 | +++ b/libarchive/archive_read_support_format_rar.c | |
25 | @@ -1496,7 +1496,11 @@ read_header(struct archive_read *a, struct archive_entry *entry, | |
26 | return (ARCHIVE_FATAL); | |
27 | } | |
28 | filename[filename_size++] = '\0'; | |
29 | - filename[filename_size++] = '\0'; | |
30 | + /* | |
31 | + * Do not increment filename_size here as the computations below | |
32 | + * add the space for the terminating NUL explicitly. | |
33 | + */ | |
34 | + filename[filename_size] = '\0'; | |
35 | ||
36 | /* Decoded unicode form is UTF-16BE, so we have to update a string | |
37 | * conversion object for it. */ | |
38 | -- | |
39 | 2.15.1 | |
40 |