From 43f789702758708eac21075c70b50f4ea96e607a Mon Sep 17 00:00:00 2001 From: zzz Date: Sat, 30 Apr 2016 13:58:36 +0000 Subject: [PATCH] Data: Fix NPE calculating the hash of a RI of unknown sig type --- core/java/src/net/i2p/data/SigningPublicKey.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/java/src/net/i2p/data/SigningPublicKey.java b/core/java/src/net/i2p/data/SigningPublicKey.java index 860985d4b..bd30d1c34 100644 --- a/core/java/src/net/i2p/data/SigningPublicKey.java +++ b/core/java/src/net/i2p/data/SigningPublicKey.java @@ -177,7 +177,10 @@ public class SigningPublicKey extends SimpleDataStructure { * @since 0.9.12 */ public void writeTruncatedBytes(OutputStream out) throws DataFormatException, IOException { - if (_type.getPubkeyLen() <= KEYSIZE_BYTES) + // we don't use _type here so we can write the data even for unknown type + //if (_type.getPubkeyLen() <= KEYSIZE_BYTES) + if (_data == null) throw new DataFormatException("No data to write out"); + if (_data.length <= KEYSIZE_BYTES) out.write(_data); else out.write(_data, 0, KEYSIZE_BYTES);