bug-tar
[Top][All Lists]
Advanced

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

[Bug-tar] Problem restoring files that have filenames exactly 512 chars


From: sa
Subject: [Bug-tar] Problem restoring files that have filenames exactly 512 chars (inc null term).
Date: Tue, 26 Jul 2005 08:46:13 -0500


I have noticed a problem restoring files where there filename plus the null terminator = 512 characters. The problem appears to be in the calculation of the number of blocks required to store the LongLink information.

The source code I have is for tar 1.15.1. I believe the problem is in the list.c - read_header function.

The code from line  377

          else if (header->header.typeflag == GNUTYPE_LONGNAME
                   || header->header.typeflag == GNUTYPE_LONGLINK)
            {
              size_t name_size = current_stat_info.stat.st_size;
              size = name_size - name_size % BLOCKSIZE + 2 * BLOCKSIZE;
              if (name_size != current_stat_info.stat.st_size
                  || size < name_size)
                xalloc_die ();

For files with a filename length of exactly 512 characters, and multiples of, the size is calculated as 1536 causing the read to require an extra null block after the name data. This I believe is incorrect and should only be 1024 as calculated in the write_gnu_long_link function in create.c

Regards,

Steve.


---------------------------------------------------------------
Vogon International Limited
http://www.vogon-international.com

reply via email to

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