提交 cb346a83 编写于 作者: A alanb

6736390: File TOCTOU deserialization vulnerability

Reviewed-by: hawtin
上级 a21484e3
...@@ -2064,11 +2064,12 @@ public class File ...@@ -2064,11 +2064,12 @@ public class File
private synchronized void readObject(java.io.ObjectInputStream s) private synchronized void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException 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 char sep = s.readChar(); // read the previous separator char
if (sep != separatorChar) if (sep != separatorChar)
this.path = this.path.replace(sep, separatorChar); pathField = pathField.replace(sep, separatorChar);
this.path = fs.normalize(this.path); this.path = fs.normalize(pathField);
this.prefixLength = fs.prefixLength(this.path); this.prefixLength = fs.prefixLength(this.path);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册