From ff0c168d65ca3b27b421574dea22f77de27aeca1 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Sun, 26 Dec 2010 12:29:55 +0000
Subject: [PATCH]     * Certificate: Fix fatal null cert error

---
 core/java/src/net/i2p/data/Certificate.java | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/core/java/src/net/i2p/data/Certificate.java b/core/java/src/net/i2p/data/Certificate.java
index 798c296808..d7ceabaebd 100644
--- a/core/java/src/net/i2p/data/Certificate.java
+++ b/core/java/src/net/i2p/data/Certificate.java
@@ -111,8 +111,10 @@ public class Certificate extends DataStructureImpl {
             DataHelper.writeLong(out, 2, 0L);
         }
     }
-    
-    
+
+    /**
+     *  @return the written length (NOT the new offset)    
+     */    
     public int writeBytes(byte target[], int offset) {
         int cur = offset;
         DataHelper.toLong(target, cur, 1, _type);
@@ -242,7 +244,7 @@ public class Certificate extends DataStructureImpl {
         @Override
         public int writeBytes(byte target[], int offset) {
             System.arraycopy(NULL_DATA, 0, target, offset, NULL_LENGTH);
-            return offset + NULL_LENGTH;
+            return NULL_LENGTH;
         }
     
         /** @throws RuntimeException always */
-- 
GitLab