summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 8e7437a..332ac0d 100644
--- a/src/main.c
+++ b/src/main.c
@@ -57,6 +57,8 @@ _opkg_opk_main_extract(const char *file_name, const char *outer_member,
struct _opkg_opk_main_file file;
struct opkg_opk_gzip *outer_gzip;
struct opkg_opk_ustar *outer_ustar;
+ char *buffer;
+ size_t size;
struct opkg_opk_gzip *inner_gzip;
struct opkg_opk_ustar *inner_ustar;
@@ -79,6 +81,22 @@ _opkg_opk_main_extract(const char *file_name, const char *outer_member,
goto error2;
}
+ if (opkg_opk_ustar_seek(outer_ustar, 1, "debian-binary") !=
+ OPKG_OPK_OK) {
+ fputs("Error: Failed to find \"debian-binary\" in archive\n",
+ stderr);
+ goto error3;
+ }
+ if (opkg_opk_ustar_read(outer_ustar, &buffer, &size) != OPKG_OPK_OK) {
+ fputs("Error: Failed to read \"debian-binary\" in archive\n",
+ stderr);
+ goto error3;
+ }
+ if (size < 4 || strncmp(buffer, "2.", 2) != 0) {
+ fputs("Error: Unsupported package version\n", stderr);
+ goto error3;
+ }
+
if (opkg_opk_ustar_seek(outer_ustar, 1, outer_member) != OPKG_OPK_OK) {
fprintf(stderr, "Error: Failed to find \"%s\" in archive\n",
outer_member);