Просмотр исходного кода

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
Родитель
Сommit
892a742c40
1 измененных файлов с 4 добавлено и 0 удалено
  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. */