Thanks to
authorticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 12 Feb 2009 13:27:50 +0000 (13:27 +0000)
committerticktock35 <ticktock35@e8e0d7a0-c8d9-11dd-a880-a1081c7ac358>
Thu, 12 Feb 2009 13:27:50 +0000 (13:27 +0000)
Frans Meulenbroeks

http://groups.google.com/group/opkg-devel/browse_thread/thread/23c3557277de0f2e

If a file name in a tar archive is exactly 100 bytes long the name
field is completely filled and there is no terminating null byte;
so extraction of the file will yield a name that is extended with the
mode (e.g. 000644).

The attached patch cures it although there might be better solutions.
The problem is also in busybox tar and reported there too.

Frans.

git-svn-id: http://opkg.googlecode.com/svn/trunk@201 e8e0d7a0-c8d9-11dd-a880-a1081c7ac358

libbb/unarchive.c

index bb70ccb9532495279dce5870777c0fd40d96c80a..24877e75452785aa426efc91a4f1ca26de987dd2 100644 (file)
@@ -606,6 +606,10 @@ file_header_t *get_header_tar(FILE *tar_stream)
                 tar_entry->name = concat_path_file(tar.formated.prefix, tar.formated.name);
         }
 
+       if (strlen(tar_entry->name) > 100) {
+               tar_entry->name[100] = 0;
+       }
+
        // tar_entry->name = xstrdup(tar.formated.name);
 
 /*