mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-24 10:11:24 +01:00
Check texture data is actually valid
This commit is contained in:
parent
7023ac4c54
commit
261ac1b4b1
@ -1,6 +1,8 @@
|
||||
package net.citizensnpcs.trait;
|
||||
|
||||
import com.google.common.base.Charsets;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.BaseEncoding;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -196,6 +198,10 @@ public class SkinTrait extends Trait {
|
||||
Preconditions.checkNotNull(data);
|
||||
|
||||
setSkinNameInternal(skinName);
|
||||
String json = new String(BaseEncoding.base64().decode(textureRaw), Charsets.UTF_8);
|
||||
if (!json.contains("textures")) {
|
||||
throw new IllegalArgumentException("Invalid texture data");
|
||||
}
|
||||
this.signature = signature;
|
||||
this.textureRaw = data;
|
||||
this.updateSkins = false;
|
||||
|
Loading…
Reference in New Issue
Block a user