Skip to content

Commit f64f680

Browse files
committed
Syncronize and check that they are not trying to break us
1 parent 9d6fb46 commit f64f680

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

Diff for: src/main/kotlin/me/urielsalis/mccrashlib/deobfuscator/Deobfuscator.kt

+15-6
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,26 @@ fun getDeobfuscation(modded: Boolean, version: String, content: String, isClient
1818
if (modded) {
1919
return null
2020
}
21+
22+
if (version.isBlank() || version.contains("\\") || version.contains("/")) {
23+
return null
24+
}
25+
2126
val name = if (isClient) {
2227
"$version-client"
2328
} else {
2429
"$version-server"
2530
}
26-
val mappingFile = File(mappingsFile, name)
27-
if (!mappingFile.exists()) {
28-
downloadMapping(version, name, isClient)
29-
}
30-
if (!mappingFile.exists()) {
31-
return null
31+
32+
val mappingFile = synchronized(mappingsFile) {
33+
val mappingFile = File(mappingsFile, name)
34+
if (!mappingFile.exists()) {
35+
downloadMapping(version, name, isClient)
36+
}
37+
if (!mappingFile.exists()) {
38+
return null
39+
}
40+
mappingFile
3241
}
3342
val retrace = ReTrace(ReTrace.REGULAR_EXPRESSION, false, true, mappingFile)
3443
val stringWriter = StringWriter()

0 commit comments

Comments
 (0)