Parcourir la source

libdpkg: Preserve error status while reading GNU long tar names

The code was unconditionally setting the status to 0, as that's what the
rest of the code expects, but it was not preserving the negative value
that gets set on error.

This was spotted by a run with the clang static analyzer.
Guillem Jover il y a 16 ans
Parent
commit
892a742c40
1 fichiers modifiés avec 4 ajouts et 0 suppressions
  1. 4 0
      lib/dpkg/tarfn.c

+ 4 - 0
lib/dpkg/tarfn.c

@@ -307,6 +307,10 @@ TarExtractor(void *userData, const TarFunctions *functions)
 				bp += copysize;
 			};
 
+			/* In case of error do not overwrite status with 0. */
+			if (status < 0)
+				break;
+
 			/* This decode function expects status to be 0 after
 			 * the case statement if we successfully decoded. I
 			 * guess what we just did was successful. */