jdk/src/share/classes/sun/security/tools/JarSigner.java
changeset 3047 30e88a671e72
parent 2432 dc17f417ef85
child 3318 dade78e63c92
--- a/jdk/src/share/classes/sun/security/tools/JarSigner.java	Wed Jun 17 15:26:58 2009 +0800
+++ b/jdk/src/share/classes/sun/security/tools/JarSigner.java	Thu Jun 18 11:12:13 2009 +0800
@@ -1402,9 +1402,14 @@
     }
 
     /**
-     * Find the position of \r\n\r\n inside bs
+     * Find the position of an empty line inside bs
      */
     private int findHeaderEnd(byte[] bs) {
+        // An empty line can be at the beginning...
+        if (bs.length > 1 && bs[0] == '\r' && bs[1] == '\n') {
+            return 0;
+        }
+        // ... or after another line
         for (int i=0; i<bs.length-3; i++) {
             if (bs[i] == '\r' && bs[i+1] == '\n' &&
                     bs[i+2] == '\r' && bs[i+3] == '\n') {