summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-07-30 14:29:20 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-07-30 14:29:20 +0000
commitb3596ff2470aae78c6953475a8b4751885cd0bd1 (patch)
treefa3336a8d41db4a59e479db6e3da3e26ebeee722
parentc1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7 (diff)
downloadapk-tools-b3596ff2470aae78c6953475a8b4751885cd0bd1.tar.gz
apk-tools-b3596ff2470aae78c6953475a8b4751885cd0bd1.tar.bz2
apk-tools-b3596ff2470aae78c6953475a8b4751885cd0bd1.tar.xz
apk-tools-b3596ff2470aae78c6953475a8b4751885cd0bd1.zip
verify: report missing files rather than segfault
-rw-r--r--src/verify.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/verify.c b/src/verify.c
index 9aaf8ae..82e9b2d 100644
--- a/src/verify.c
+++ b/src/verify.c
@@ -8,6 +8,7 @@
* by the Free Software Foundation. See http://www.gnu.org/ for details.
*/
+#include <errno.h>
#include <stdio.h>
#include <unistd.h>
@@ -25,6 +26,12 @@ static int verify_main(void *ctx, int argc, char **argv)
apk_sign_ctx_init(&sctx, APK_SIGN_VERIFY, NULL);
is = apk_bstream_gunzip_mpart(apk_bstream_from_file(argv[i]),
apk_sign_ctx_mpart_cb, &sctx);
+ if (is == NULL) {
+ apk_error("%s: %s", strerror(errno), argv[i]);
+ apk_sign_ctx_free(&sctx);
+ rc++;
+ continue;
+ }
r = apk_tar_parse(is, apk_sign_ctx_verify_tar, &sctx, FALSE);
is->close(is);
ok = sctx.control_verified && sctx.data_verified;