diff --git a/sys/bootstrap/tar.c b/sys/bootstrap/tar.c index 966b03a..7be6544 100644 --- a/sys/bootstrap/tar.c +++ b/sys/bootstrap/tar.c @@ -74,8 +74,10 @@ int tar_open(struct tar *tar, const char *path, struct tar_file *out) } s += header.size; - s += ((sizeof *bin_header) - - ((uintptr_t)s % (sizeof *bin_header))); + if ((uintptr_t)s % (sizeof *bin_header)) { + s += ((sizeof *bin_header) + - ((uintptr_t)s % (sizeof *bin_header))); + } bin_header = (struct tar_bin_header *)s; } @@ -382,8 +384,10 @@ static enum fs_status build_dentry_tree( } s += header.size; - s += ((sizeof *bin_header) - - ((uintptr_t)s % (sizeof *bin_header))); + if ((uintptr_t)s % (sizeof *bin_header)) { + s += ((sizeof *bin_header) + - ((uintptr_t)s % (sizeof *bin_header))); + } bin_header = (struct tar_bin_header *)s; }