]> source.dussan.org Git - poi.git/commitdiff
bug 62608 -- avoid ioobe in VBAMacroReader
authorTim Allison <tallison@apache.org>
Wed, 8 Aug 2018 17:30:02 +0000 (17:30 +0000)
committerTim Allison <tallison@apache.org>
Wed, 8 Aug 2018 17:30:02 +0000 (17:30 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1837664 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/poi/poifs/macros/VBAMacroReader.java

index 6a5fa620a734df969bdf0b5bce227d4dc510ce7e..04402e58cb3d879fb6086d2a92d5a0fbfcba9652 100644 (file)
@@ -591,9 +591,11 @@ public class VBAMacroReader implements Closeable {
         for (String line : properties.split("\r\n|\n\r")) {
             if (!line.startsWith("[")) {
                 String[] tokens = line.split("=");
-                if (tokens.length > 1 && tokens[1].length() > 1 && tokens[1].startsWith("\"")) {
-                    // Remove any double qouates
-                    tokens[1] = tokens[1].substring(1, tokens[1].length() - 2);
+                if (tokens.length > 1 && tokens[1].length() > 1
+                        && tokens[1].startsWith("\"") && tokens[1].endsWith("\"")) {
+                    // Remove any double quotes
+                    tokens[1] = tokens[1].substring(1, tokens[1].length() - 1);
+
                 }
                 if ("Document".equals(tokens[0])) {
                     String mn = tokens[1].substring(0, tokens[1].indexOf("/&H"));