bug-cpio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-cpio] ustar mtime overflow (#238177)


From: Clint Adams
Subject: [Bug-cpio] ustar mtime overflow (#238177)
Date: Sun, 04 Sep 2005 04:26:37 -0000
User-agent: Mutt/1.5.9i

This is a forward-port of the patch in Debian bug #238177.

http://bugs.debian.org/238177

diff -u -r1.9 tar.c
--- src/tar.c   25 May 2005 13:09:26 -0000      1.9
+++ src/tar.c   4 Sep 2005 03:50:53 -0000
@@ -108,6 +108,18 @@
     where[--digits] = '0';
 }
 
+/* Convert a number into a string of octal digits.
+   Convert long VALUE into a DIGITS-digit field at WHERE,
+   including a trailing space.  DIGITS==2 means
+   1 digit, and a space.
+*/
+
+static void
+to_oct_no_nul (register long value, register int digits, register char *where)
+{
+  to_oct (value, digits + 1, where);
+}
+
 
 
 /* Compute and return a checksum for TAR_HDR,
@@ -168,8 +180,8 @@
   to_oct (file_hdr->c_mode & MODE_ALL, 8, tar_hdr->mode);
   to_oct (file_hdr->c_uid, 8, tar_hdr->uid);
   to_oct (file_hdr->c_gid, 8, tar_hdr->gid);
-  to_oct (file_hdr->c_filesize, 12, tar_hdr->size);
-  to_oct (file_hdr->c_mtime, 12, tar_hdr->mtime);
+  to_oct_no_nul (file_hdr->c_filesize, 12, tar_hdr->size);
+  to_oct_no_nul (file_hdr->c_mtime, 12, tar_hdr->mtime);
 
   switch (file_hdr->c_mode & CP_IFMT)
     {




reply via email to

[Prev in Thread] Current Thread [Next in Thread]