diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-07-25 08:52:43 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-07-25 08:52:43 +0300 |
commit | c1405f9311a1789727c14858e1bb770965fa03ff (patch) | |
tree | aec26ee474d5c3d95d68b058195e0aae628542f1 /src/adb_comp.c | |
parent | 3d203e8f5f35cd5e34c3d0b80ebdcc7d8d33bee7 (diff) | |
download | apk-tools-c1405f9311a1789727c14858e1bb770965fa03ff.tar.gz apk-tools-c1405f9311a1789727c14858e1bb770965fa03ff.tar.bz2 apk-tools-c1405f9311a1789727c14858e1bb770965fa03ff.tar.xz apk-tools-c1405f9311a1789727c14858e1bb770965fa03ff.zip |
adb: fix error handling of non-adb files
Diffstat (limited to 'src/adb_comp.c')
-rw-r--r-- | src/adb_comp.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/adb_comp.c b/src/adb_comp.c index b697101..26fb50f 100644 --- a/src/adb_comp.c +++ b/src/adb_comp.c @@ -11,13 +11,14 @@ struct apk_istream *adb_decompress(struct apk_istream *is, adb_comp_t *compression) { - adb_comp_t c = -1; + adb_comp_t c = -1; if (IS_ERR_OR_NULL(is)) return is; uint8_t *buf = apk_istream_peek(is, 4); if (IS_ERR(buf)) return ERR_PTR(apk_istream_close_error(is, PTR_ERR(buf))); - if (memcmp(buf, "ADB", 3) == 0) switch (buf[3]) { + if (memcmp(buf, "ADB", 3) != 0) return ERR_PTR(apk_istream_close_error(is, -APKE_ADB_HEADER)); + switch (buf[3]) { case '.': c = ADB_COMP_NONE; break; |