From 619f09be066777b8296acf93bd6b51771ca64bd2 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Tue, 02 May 2023 22:22:29 -0400 Subject: ustar: Treat octets as unsigned in chksum Per POSIX. --- 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]; } -- cgit v0.9.1