Changeset 1681598


Ignore:
Timestamp:
Jul 23, 2015 1:31:39 AM (5 years ago)
Author:
str4d <str4d@…>
Branches:
master
Children:
44bd14b, fea6b8ae
Parents:
93854e9 (diff), 809a533 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge of '30be1cda5a1ad30d33bbd355f4d85785a889c9fb'

and '8ec6b122079156e35f7515afa5eb433a13ce41b0'

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/data/Certificate.java

    r93854e9 r1681598  
    4949    /**
    5050     * If null cert, return immutable static instance, else create new
    51      * @throws AIOOBE if not enough bytes, FIXME should throw DataFormatException
     51     * @throws DataFormatException if not enough bytes
    5252     * @since 0.8.3
    5353     */
    54     public static Certificate create(byte[] data, int off) {
    55         int type = data[off] & 0xff;
    56         int length = (int) DataHelper.fromLong(data, off + 1, 2);
    57         if (type == 0 && length == 0)
    58             return NULL_CERT;
    59         // from here down roughly the same as readBytes() below
    60         if (length == 0)
    61             return new Certificate(type, null);
    62         byte[] payload = new byte[length];
    63         System.arraycopy(data, off + 3, payload, 0, length);
     54    public static Certificate create(byte[] data, int off) throws DataFormatException {
     55        int type;
     56        byte[] payload;
     57        try {
     58            type = data[off] & 0xff;
     59            int length = (int) DataHelper.fromLong(data, off + 1, 2);
     60            if (type == 0 && length == 0)
     61                return NULL_CERT;
     62            // from here down roughly the same as readBytes() below
     63            if (length == 0)
     64                return new Certificate(type, null);
     65            payload = new byte[length];
     66            System.arraycopy(data, off + 3, payload, 0, length);
     67        } catch (ArrayIndexOutOfBoundsException aioobe) {
     68                throw new DataFormatException("not enough bytes", aioobe);
     69        }
    6470        if (type == CERTIFICATE_TYPE_KEY) {
    6571            try {
  • history.txt

    r93854e9 r1681598  
     12015-07-21 str4d
     2 * Core: Throw DFE in Certificate.create() instead of AIOOBE (ticket #1016)
     3
     42015-07-21 str4d
     5 * Core: Fix parsing bug in KeyCertificate
     6
    172015-07-16 zzz
    28 * Console: Add dates to news headings
Note: See TracChangeset for help on using the changeset viewer.