Commit cfa8b736 authored by Fredrik Gustafsson's avatar Fredrik Gustafsson Committed by Timo Teräs

Don't unpack files to system root

When unpacking a file that is in root, it got a temporary file
name /.apk...  however if the --root option was used it should
have the name root/.apk... otherwise unpacking will fail if the
user does not have write access to /.
Signed-off-by: default avatarFredrik Gustafsson <fredrigu@axis.com>
parent 7f80a936
Pipeline #2698 failed with stage
...@@ -2391,7 +2391,11 @@ static const char *format_tmpname(struct apk_package *pkg, struct apk_db_file *f ...@@ -2391,7 +2391,11 @@ static const char *format_tmpname(struct apk_package *pkg, struct apk_db_file *f
EVP_MD_CTX_free(mdctx); EVP_MD_CTX_free(mdctx);
apk_blob_push_blob(&b, APK_BLOB_PTR_LEN(f->diri->dir->name, f->diri->dir->namelen)); apk_blob_push_blob(&b, APK_BLOB_PTR_LEN(f->diri->dir->name, f->diri->dir->namelen));
apk_blob_push_blob(&b, APK_BLOB_STR("/.apk.")); if (f->diri->dir->namelen > 0) {
apk_blob_push_blob(&b, APK_BLOB_STR("/.apk."));
} else {
apk_blob_push_blob(&b, APK_BLOB_STR(".apk."));
}
apk_blob_push_hexdump(&b, APK_BLOB_PTR_LEN((char *)md, 24)); apk_blob_push_hexdump(&b, APK_BLOB_PTR_LEN((char *)md, 24));
apk_blob_push_blob(&b, APK_BLOB_PTR_LEN("", 1)); apk_blob_push_blob(&b, APK_BLOB_PTR_LEN("", 1));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment