[BusyBox] Bug in tar.c

Marius Groeger mag at sysgo.de
Tue May 22 01:45:12 UTC 2001


Hi,

there is a bug in tar.c when busybox tar unpacks an archive and needs
to remove leading slashes from the tar members. Instead of
incrementing the pointer to the header name string, the first char of
the string itself is incremented, leading to a checksum error further
below. I believe the error never showed up before since usually the
leading slashes are removed upon *packing* the archive. Here is a
patch:

Index: tar.c
===================================================================
RCS file: /var/cvs/busybox/tar.c,v
retrieving revision 1.113
diff -u -r1.113 tar.c
--- tar.c       2001/05/13 15:39:30     1.113
+++ tar.c       2001/05/22 07:39:14
@@ -490,7 +490,7 @@
                static int alreadyWarned=FALSE;

                while (*(header->name) == '/')
-                       ++*(header->name);
+                       header->name++;

                if (alreadyWarned == FALSE) {
                        error_msg("Removing leading '/' from member names");

Regards
Marius Groeger

-----------------------------------------------------------------------------
Marius Groeger           SYSGO Real-Time Solutions GmbH     mgroeger at sysgo.de
Software Engineering     Embedded and Real-Time Software    www.sysgo.de
Voice: +49-6136-9948-0   Am Pfaffenstein 14                 www.osek.de
FAX:   +49-6136-9948-10  55270 Klein-Winternheim, Germany   www.elinos.com







More information about the busybox mailing list