]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
cpio reader: use strncmp() when comparing against TRAILER!!!
authorMartin Matuska <martin@matuska.org>
Wed, 25 Jan 2017 21:54:14 +0000 (22:54 +0100)
committerMartin Matuska <martin@matuska.org>
Wed, 25 Jan 2017 22:04:56 +0000 (23:04 +0100)
Reported-By: OSS-Fuzz issue 422

libarchive/archive_read_support_format_cpio.c

index 89f9188cd1042f10c4b88f69c5072dc163f82df2..d4f6ffd912630bba31373d4978c7524953fe7586 100644 (file)
@@ -434,7 +434,8 @@ archive_read_format_cpio_read_header(struct archive_read *a,
         * header.  XXX */
 
        /* Compare name to "TRAILER!!!" to test for end-of-archive. */
-       if (namelength == 11 && strcmp((const char *)h, "TRAILER!!!") == 0) {
+       if (namelength == 11 && memcmp((const char *)h, "TRAILER!!!",
+           11) == 0) {
                /* TODO: Store file location of start of block. */
                archive_clear_error(&a->archive);
                return (ARCHIVE_EOF);