bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] tar breaks on long filenames


From: Mads Martin Joergensen
Subject: [Bug-tar] tar breaks on long filenames
Date: Mon, 9 Aug 2004 23:48:54 +0200
User-agent: Mutt/1.5.6i

Hey there,

This one came in:

# z=`perl -e 'print "z" x 200'` 
# dd if=/dev/zero of=$z bs=1k count=15 
15+0 records in 
15+0 records out 
# tar -M -L 10 -cf z.tar $z  
Prepare volume #2 for `z.tar' and hit return:  
# ll z.tar  
-rw-r--r--  1 snwint suse 10240 Aug  5 14:56 z.tar 
# tar -tvf z.tar  
tar: Archive contains `zzzzzzzz' where numeric mode_t value expected 
tar: Archive contains `zzzzzzzzzzzz' where numeric time_t value expected 
tar: Archive contains `zzzzzzzz' where numeric uid_t value expected 
tar: Archive contains `zzzzzzzz' where numeric gid_t value expected 
tar: Archive contains `zzzzzzzz' where numeric uid_t value expected 
tar: Archive contains `zzzzzzzz' where numeric gid_t value expected 
Mrwsrwsrwt -1/-1          6656 1970-01-01 00:59:59 
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz--Continued
 at byte 8704-- 
tar: Error exit delayed from previous errors

How about this fix?

--- src/buffer.c        2004-07-19 11:04:53.000000000 +0200
+++ src/buffer.c        2004-07-19 11:21:55.000000000 +0200
@@ -957,7 +957,7 @@
         when a new volume rolls around [...]  Looks like the wrong value is
         being preserved in real_s_name, though.  */
 
-      strcpy (record_start->header.name, real_s_name);
+      strncpy (record_start->header.name, real_s_name, 
NAME_FIELD_SIZE)[NAME_FIELD_SIZE - 1] = '\0';
       record_start->header.typeflag = GNUTYPE_MULTIVOL;
       OFF_TO_CHARS (real_s_sizeleft, record_start->header.size);
       OFF_TO_CHARS (real_s_totsize - real_s_sizeleft,
@@ -1153,7 +1153,7 @@
        {
          uintmax_t s1, s2;
          if (cursor->header.typeflag != GNUTYPE_MULTIVOL
-             || strcmp (cursor->header.name, real_s_name))
+             || strncmp (cursor->header.name, real_s_name, NAME_FIELD_SIZE - 
1))
            {
              WARN ((0, 0, _("%s is not continued on this volume"),
                     quote (real_s_name)));


-- 
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
 and totally illogical, with just a little bit more effort?"
                                -- A. P. J.




reply via email to

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