Skip to content

Commit

Permalink
fix: Fixed use of insecure 'Path.GetTempFileName' in ExternalRefSorte…
Browse files Browse the repository at this point in the history
  • Loading branch information
nikcio authored Oct 14, 2022
1 parent edc85af commit 5988c77
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Lucene.Net.Suggest/Suggest/Fst/ExternalRefSorter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class ExternalRefSorter : IBytesRefSorter, IDisposable
public ExternalRefSorter(OfflineSorter sort)
{
this.sort = sort;
this.input = new FileInfo(Path.GetTempFileName());
this.input = new FileInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
this.writer = new OfflineSorter.ByteSequencesWriter(input);
}

Expand All @@ -58,7 +58,7 @@ public virtual IBytesRefEnumerator GetEnumerator()
{
CloseWriter();

sorted = new FileInfo(Path.GetTempFileName());
sorted = new FileInfo(Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()));
sort.Sort(input, sorted);

input.Delete();
Expand Down

0 comments on commit 5988c77

Please sign in to comment.