Skip to content

Commit

Permalink
o Updated to guard against directory traversal issues.
Browse files Browse the repository at this point in the history
Fixes #4
  • Loading branch information
ChristianSchulte committed May 7, 2016
1 parent f933e5e commit 33a2853
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/java/org/codehaus/plexus/util/Expand.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,12 @@ protected void extractFile( File srcF, File dir, InputStream compressedInputStre
throws Exception
{
File f = FileUtils.resolveFile( dir, entryName );

if ( !f.getAbsolutePath().startsWith( dir.getAbsolutePath() ) )
{
throw new IOException( "Entry '" + entryName + "' outside the target directory." );
}

try
{
if ( !overwrite && f.exists() && f.lastModified() >= entryDate.getTime() )
Expand Down

0 comments on commit 33a2853

Please sign in to comment.