Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
ensure null terminated filename
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinNowak committed Aug 29, 2015
1 parent 91a669b commit 7c05b9f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions src/rt/profilegc.d
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ shared static ~this()
{
qsort(counts.ptr, counts.length, Result.sizeof, &Result.qsort_cmp);

FILE* fp = logfilename.length == 0 ? stdout : fopen(logfilename.ptr, "w");
FILE* fp = logfilename.length == 0 ? stdout : fopen((logfilename ~ '\0').ptr, "w");
if (fp)
{
fprintf(fp, "bytes allocated, type, function, file:line\n");
Expand All @@ -149,5 +149,3 @@ shared static ~this()
fprintf(stderr, "cannot write profilegc log file '%.*s'", logfilename.length, logfilename.ptr);
}
}


4 changes: 2 additions & 2 deletions src/rt/trace.d
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,7 @@ shared static ~this()

// Report results
FILE* fplog = trace_logfilename.length == 0 ? stdout :
fopen(trace_logfilename.ptr, "w");
fopen((trace_logfilename ~ '\0').ptr, "w");
if (fplog)
{
auto nsymbols = trace_report(fplog, groot);
Expand All @@ -498,7 +498,7 @@ shared static ~this()

// Output function link order
FILE* fpdef = trace_deffilename.length == 0 ? stdout :
fopen(trace_deffilename.ptr, "w");
fopen((trace_deffilename ~ '\0').ptr, "w");
if (fpdef)
{
fprintf(fpdef,"\nFUNCTIONS\n");
Expand Down

0 comments on commit 7c05b9f

Please sign in to comment.