Improve fml mod list parsing
This commit is contained in:
@@ -79,6 +79,8 @@ public final class ModInfo {
|
|||||||
public Mod(String id, String version) {
|
public Mod(String id, String version) {
|
||||||
this.id = Preconditions.checkNotNull(id, "id");
|
this.id = Preconditions.checkNotNull(id, "id");
|
||||||
this.version = Preconditions.checkNotNull(version, "version");
|
this.version = Preconditions.checkNotNull(version, "version");
|
||||||
|
Preconditions.checkArgument(id.length() < 128, "mod id is too long");
|
||||||
|
Preconditions.checkArgument(version.length() < 128, "mod version is too long");
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getId() {
|
public String getId() {
|
||||||
|
@@ -64,6 +64,7 @@ class LegacyForgeUtil {
|
|||||||
if (discriminator == MOD_LIST_DISCRIMINATOR) {
|
if (discriminator == MOD_LIST_DISCRIMINATOR) {
|
||||||
ImmutableList.Builder<ModInfo.Mod> mods = ImmutableList.builder();
|
ImmutableList.Builder<ModInfo.Mod> mods = ImmutableList.builder();
|
||||||
int modCount = ProtocolUtils.readVarInt(contents);
|
int modCount = ProtocolUtils.readVarInt(contents);
|
||||||
|
Preconditions.checkArgument(modCount < 1024, "Oversized mods list");
|
||||||
|
|
||||||
for (int index = 0; index < modCount; index++) {
|
for (int index = 0; index < modCount; index++) {
|
||||||
String id = ProtocolUtils.readString(contents);
|
String id = ProtocolUtils.readString(contents);
|
||||||
|
Reference in New Issue
Block a user