summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2023-05-02 22:22:29 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2023-05-02 22:22:29 (EDT)
commit619f09be066777b8296acf93bd6b51771ca64bd2 (patch)
tree9217bdbc366d4cd7af114137dbdcf3b17ad28b51
parent586965c9cdf63170ccc3713ebf87201c46d3428c (diff)
ustar: Treat octets as unsigned in chksum
Per POSIX.
-rw-r--r--src/ustar.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ustar.c b/src/ustar.c
index 8c31f7a..d70a616 100644
--- a/src/ustar.c
+++ b/src/ustar.c
@@ -271,9 +271,9 @@ opkg_opk_ustar_write_header(struct opkg_opk_ustar *ustar,
uid_t uid, const char *uname, gid_t gid, const char *gname,
uint64_t size, int64_t mtime, char type, const char *linkname)
{
- uint32_t chksum;
- size_t i;
- char *header_uc;
+ uint32_t chksum;
+ size_t i;
+ unsigned char *header_uc;
memset(&ustar->header, 0, sizeof(ustar->header));
@@ -322,7 +322,7 @@ opkg_opk_ustar_write_header(struct opkg_opk_ustar *ustar,
for (i = 0; i < sizeof(ustar->header.chksum); ++i) {
ustar->header.chksum[i] = ' ';
}
- header_uc = (char *) &ustar->header;
+ header_uc = (unsigned char *) &ustar->header;
for (i = 0; i < OPKG_OPK_USTAR_RECORD_SIZE; ++i) {
chksum += header_uc[i];
}