You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by rg...@apache.org on 2016/10/25 16:39:19 UTC

svn commit: r1766553 - /qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java

Author: rgodfrey
Date: Tue Oct 25 16:39:19 2016
New Revision: 1766553

URL: http://svn.apache.org/viewvc?rev=1766553&view=rev
Log:
QPID-7470 : Make regex for matching base64 more precise

Modified:
    qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java

Modified: qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java
URL: http://svn.apache.org/viewvc/qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java?rev=1766553&r1=1766552&r2=1766553&view=diff
==============================================================================
--- qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java (original)
+++ qpid/java/trunk/common/src/main/java/org/apache/qpid/util/Strings.java Tue Oct 25 16:39:19 2016
@@ -130,7 +130,7 @@ public final class Strings
     public static byte[] decodeBase64(String base64String)
     {
         base64String = base64String.replaceAll("\\s","");
-        if(!base64String.matches("[A-Za-z0-9+/]*[=]*"))
+        if(!base64String.matches("^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$"))
         {
             throw new IllegalArgumentException("Cannot convert string '"+ base64String+ "'to a byte[] - it does not appear to be base64 data");
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org