Skip to content

Commit

Permalink
sanitize: pass correct size to memset()
Browse files Browse the repository at this point in the history
We did not want a size of a pointer but instead size of the underlying
memory storage.
  • Loading branch information
chino committed Oct 3, 2022
1 parent 0248fe2 commit 1a4d0a6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ void * X_malloc( size_t size, char *in_file, int in_line )
BlockInLine[i] = in_line;
MemUsed += size;

memset(Pnt,0,sizeof(Pnt)); // this protects whole program against dirty memory
memset(Pnt,0,size); // this protects whole program against dirty memory

return Pnt;

Expand Down Expand Up @@ -137,7 +137,7 @@ void * X_calloc( size_t num,size_t size, char *in_file, int in_line )
BlockInLine[i] = in_line;
MemUsed += num * size;

memset(Pnt,0,sizeof(Pnt)); // this protects whole program against dirty memory
memset(Pnt,0,size); // this protects whole program against dirty memory

return Pnt;

Expand Down

0 comments on commit 1a4d0a6

Please sign in to comment.