summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ustar.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/src/ustar.c b/src/ustar.c
index c183560..4cc4651 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -114,10 +114,26 @@ _opkg_opk_ustar_next(struct opkg_opk_ustar *ustar,
return OPKG_OPK_ERROR;
}
- ustar->data_size_remaining = strtol((char *) header->size, &end,
- OPKG_OPK_USTAR_NUM_BASE_);
- if (*end != '\0') {
- return OPKG_OPK_ERROR;
+ switch (*header->typeflag) {
+ case '0': /* Regular file */
+ case '7': /* High-performance or regular file */
+ ustar->data_size_remaining = strtol(
+ (char *) header->size, &end,
+ OPKG_OPK_USTAR_NUM_BASE_);
+ if (*end != '\0') {
+ return OPKG_OPK_ERROR;
+ }
+ break;
+ case '2': /* Symbolic link */
+ case '3': /* Character special file */
+ case '4': /* Block special file */
+ case '5': /* Directory */
+ case '6': /* FIFO special file */
+ ustar->data_size_remaining = 0;
+ break;
+ case '1': /* Link */
+ default: /* Reserved */
+ return OPKG_OPK_ERROR; /* Unsupported */
}
return OPKG_OPK_OK;