Skip to content

Commit

Permalink
Fix memset'ing of buffer in strrep
Browse files Browse the repository at this point in the history
`strlen(buf)` is not guaranteed to return the size of the buffer, as it
might contain some null bytes in the middle.

Fixes htacg#1001
  • Loading branch information
alpire committed Oct 27, 2021
1 parent 14223a9 commit df5bc80
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tmbstr.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ void TY_(strrep)(tmbstr buffer, ctmbstr str, ctmbstr rep)
if(p)
{
char buf[1024];
memset(buf,'\0',strlen(buf));
memset(buf,'\0',sizeof(buf));

if(buffer == p)
{
Expand Down

0 comments on commit df5bc80

Please sign in to comment.