Explorar el Código

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 hace 16 años
padre
commit
892a742c40
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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;
 				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
 			/* This decode function expects status to be 0 after
 			 * the case statement if we successfully decoded. I
 			 * the case statement if we successfully decoded. I
 			 * guess what we just did was successful. */
 			 * guess what we just did was successful. */