Explorar o código

libdpkg: When decoding the tar header assign the TarInfo Type first

Guillem Jover %!s(int64=16) %!d(string=hai) anos
pai
achega
e6b62bd49f
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      lib/dpkg/tarfn.c

+ 2 - 1
lib/dpkg/tarfn.c

@@ -128,6 +128,8 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 	else
 		d->format = tar_format_old;
 
+	d->Type = (enum tar_filetype)h->LinkFlag;
+
 	if (*h->UserName)
 		passwd = getpwnam(h->UserName);
 	if (*h->GroupName)
@@ -149,7 +151,6 @@ DecodeTarHeader(char *block, struct TarInfo *d)
 	checksum = OtoL(h->Checksum, sizeof(h->Checksum));
 	d->UserID = (uid_t)OtoL(h->UserID, sizeof(h->UserID));
 	d->GroupID = (gid_t)OtoL(h->GroupID, sizeof(h->GroupID));
-	d->Type = (enum tar_filetype)h->LinkFlag;
 
 	if (passwd)
 		d->UserID = passwd->pw_uid;