package: fail on invalid control data
Handle meta data error to produce hard failure. fixes #10806cute-signatures
parent
e8650d4d44
commit
a2cd188039
|
@ -2398,8 +2398,13 @@ static int apk_db_install_v2meta(struct apk_extract_ctx *ectx, struct apk_istrea
|
||||||
{
|
{
|
||||||
struct install_ctx *ctx = container_of(ectx, struct install_ctx, ectx);
|
struct install_ctx *ctx = container_of(ectx, struct install_ctx, ectx);
|
||||||
apk_blob_t l, token = APK_BLOB_STR("\n");
|
apk_blob_t l, token = APK_BLOB_STR("\n");
|
||||||
while (apk_istream_get_delim(is, token, &l) == 0)
|
int r;
|
||||||
read_info_line(ctx, l);
|
|
||||||
|
while (apk_istream_get_delim(is, token, &l) == 0) {
|
||||||
|
r = read_info_line(ctx, l);
|
||||||
|
if (r < 0) return r;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -568,7 +568,7 @@ int apk_pkg_add_info(struct apk_database *db, struct apk_package *pkg,
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
if (APK_BLOB_IS_NULL(value))
|
if (APK_BLOB_IS_NULL(value))
|
||||||
return -1;
|
return -APKE_V2PKG_FORMAT;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -644,12 +644,9 @@ static int read_info_line(struct read_info_ctx *ri, apk_blob_t line)
|
||||||
|
|
||||||
apk_extract_v2_control(&ri->ectx, l, r);
|
apk_extract_v2_control(&ri->ectx, l, r);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(fields); i++) {
|
for (i = 0; i < ARRAY_SIZE(fields); i++)
|
||||||
if (apk_blob_compare(APK_BLOB_STR(fields[i].str), l) == 0) {
|
if (apk_blob_compare(APK_BLOB_STR(fields[i].str), l) == 0)
|
||||||
apk_pkg_add_info(ri->db, ri->pkg, fields[i].field, r);
|
return apk_pkg_add_info(ri->db, ri->pkg, fields[i].field, r);
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -658,8 +655,13 @@ static int apk_pkg_v2meta(struct apk_extract_ctx *ectx, struct apk_istream *is)
|
||||||
{
|
{
|
||||||
struct read_info_ctx *ri = container_of(ectx, struct read_info_ctx, ectx);
|
struct read_info_ctx *ri = container_of(ectx, struct read_info_ctx, ectx);
|
||||||
apk_blob_t l, token = APK_BLOB_STR("\n");
|
apk_blob_t l, token = APK_BLOB_STR("\n");
|
||||||
while (apk_istream_get_delim(is, token, &l) == 0)
|
int r;
|
||||||
read_info_line(ri, l);
|
|
||||||
|
while (apk_istream_get_delim(is, token, &l) == 0) {
|
||||||
|
r = read_info_line(ri, l);
|
||||||
|
if (r < 0) return r;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue