summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-04-13 02:06:22 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-04-13 03:24:49 (EDT)
commit7fff5e5955591ada15f4633a31932dc9d6c8086d (patch)
tree8d89d0f3cc4c6b55e7d28f5224b4557377faa5e6
parent05ad0bdfa97117cee96bf4bc6ab131e1aaaed5ec (diff)
ustar: Verify magic
-rw-r--r--src/ustar.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ustar.c b/src/ustar.c
index 6388d76..63998ec 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -20,6 +20,7 @@
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "defs.h"
#include "gzip.h"
#include "ustar.h"
@@ -62,6 +63,10 @@ _opkg_opk_ustar_next(struct opkg_opk_gzip_state *gzip_state, const char *member,
case OPKG_OPK_ERROR:
return OPKG_OPK_ERROR;
}
+ if (strncmp(header->magic, "ustar", strlen("ustar")) != 0) {
+ return OPKG_OPK_ERROR;
+ }
+
size = strtol(header->size, &size_end, 10);
if (*size_end != '\0') {
return OPKG_OPK_ERROR;