]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Avoid problems because of varying ino_t sizes on different platforms. In particular...
authorTim Kientzle <kientzle@gmail.com>
Thu, 14 May 2009 23:55:24 +0000 (19:55 -0400)
committerTim Kientzle <kientzle@gmail.com>
Thu, 14 May 2009 23:55:24 +0000 (19:55 -0400)
SVN-Revision: 1082

libarchive/archive_write_set_format_cpio.c

index c20abf80996a098a1569e12a960becd1c9f8a3f0..043bf3ccd94035d5b6e8ef4bedcc2e540ed2bee4 100644 (file)
@@ -109,6 +109,7 @@ archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
        struct cpio *cpio;
        const char *p, *path;
        int pathlength, ret;
+       int64_t ino;
        struct cpio_header       h;
 
        cpio = (struct cpio *)a->format_data;
@@ -125,7 +126,8 @@ archive_write_cpio_header(struct archive_write *a, struct archive_entry *entry)
         * re-using the ones off the disk.  That way, the 18-bit c_ino
         * field only limits the number of files in the archive.
         */
-       if ((int)archive_entry_ino(entry) > 0777777) {
+       ino = (int64_t)archive_entry_ino(entry);
+       if (ino < 0 || ino > 0777777) {
                archive_set_error(&a->archive, ERANGE,
                    "large inode number truncated");
                ret = ARCHIVE_WARN;