From e82359a347e9793d27e2670d926e6bd5ed22a909 Mon Sep 17 00:00:00 2001 From: Gravit Date: Sat, 27 Oct 2018 00:23:27 +0700 Subject: [PATCH] =?UTF-8?q?=D0=92=D0=B5=D1=80=D0=BD=D1=83=D0=BB=20=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D1=83=20runtime?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libLauncher/src/main/java/ru/gravit/launcher/Launcher.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java index 1fc4b911..35079af5 100644 --- a/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java +++ b/libLauncher/src/main/java/ru/gravit/launcher/Launcher.java @@ -89,9 +89,15 @@ public static void setConfig(LauncherConfig cfg) @LauncherAPI public static URL getResourceURL(String name) throws IOException { + LauncherConfig config = getConfig(); + byte[] validDigest = config.runtime.get(name); + if (validDigest == null) + throw new NoSuchFileException(name); // Resolve URL and verify digest URL url = IOHelper.getResourceURL(RUNTIME_DIR + '/' + name); + if (!Arrays.equals(validDigest, SecurityHelper.digest(SecurityHelper.DigestAlgorithm.MD5, url))) + throw new NoSuchFileException(name); // Digest mismatch // Return verified URL return url;