Kaynağa Gözat

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 16 yıl önce
ebeveyn
işleme
892a742c40
1 değiştirilmiş dosya ile 4 ekleme ve 0 silme
  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. */