bootstrap: tar: fix pointer-alignment tar parsing issue
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user