Skip to content

Commit 33a2853

Browse files
o Updated to guard against directory traversal issues.
Fixes #4
1 parent f933e5e commit 33a2853

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/main/java/org/codehaus/plexus/util/Expand.java

+6
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ protected void extractFile( File srcF, File dir, InputStream compressedInputStre
136136
throws Exception
137137
{
138138
File f = FileUtils.resolveFile( dir, entryName );
139+
140+
if ( !f.getAbsolutePath().startsWith( dir.getAbsolutePath() ) )
141+
{
142+
throw new IOException( "Entry '" + entryName + "' outside the target directory." );
143+
}
144+
139145
try
140146
{
141147
if ( !overwrite && f.exists() && f.lastModified() >= entryDate.getTime() )

0 commit comments

Comments
 (0)