Skip to content

Commit

Permalink
Replaced strtol with strtoul
Browse files Browse the repository at this point in the history
  • Loading branch information
martinellimarco committed Aug 22, 2022
1 parent d0ca643 commit b0c3c99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/t2sz.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ bool isTarHeader(TarHeader* header){
char* buf = malloc(7);
memcpy(buf, header->chksum, 6);
buf[6] = 0;
uint32_t hdrChksum = strtol(buf, NULL, 8);
uint32_t hdrChksum = strtoul(buf, NULL, 8);
free(buf);

if(chksum != hdrChksum){
Expand Down Expand Up @@ -308,7 +308,7 @@ void compressFile(Context *ctx){
}else if(ctx->inBuff[tarHeaderIdx]){//tar ends with null headers that we can skip
TarHeader *header = (TarHeader *)&ctx->inBuff[tarHeaderIdx];
if(isTarHeader(header)){
size_t size = strtol(header->size, NULL, 8);
size_t size = strtoul(header->size, NULL, 8);

size_t mod = size%512;
if(mod){
Expand Down

0 comments on commit b0c3c99

Please sign in to comment.