6736390: File TOCTOU deserialization vulnerability
Reviewed-by: hawtin
This commit is contained in:
parent
9b6c8a826f
commit
8358846d5f
@ -2064,11 +2064,12 @@ public class File
|
||||
private synchronized void readObject(java.io.ObjectInputStream s)
|
||||
throws IOException, ClassNotFoundException
|
||||
{
|
||||
s.defaultReadObject();
|
||||
ObjectInputStream.GetField fields = s.readFields();
|
||||
String pathField = (String)fields.get("path", null);
|
||||
char sep = s.readChar(); // read the previous separator char
|
||||
if (sep != separatorChar)
|
||||
this.path = this.path.replace(sep, separatorChar);
|
||||
this.path = fs.normalize(this.path);
|
||||
pathField = pathField.replace(sep, separatorChar);
|
||||
this.path = fs.normalize(pathField);
|
||||
this.prefixLength = fs.prefixLength(this.path);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user