otr4j / otr4j-issues

1 stars 0 forks source link

handleDataMessage() ignores data if a TLV is present #5

Closed eighthave closed 4 years ago

eighthave commented 9 years ago

The OTR spec describes a Data Message saying: "...a human-readable message..., optionally followed by... zero or more TLV (type/length/value) records..."[1] but handleDataMessage() always returns a null "human readable message" whenever a TLV is present:

                if (tlvs != null && tlvs.size() > 0) {
                    for (TLV tlv : tlvs) {
                        switch (tlv.getType()) {
                            case TLV.DISCONNECTED:
                                this.setSessionStatus(SessionStatus.FINISHED);
                                return null;
                            default:
                                if (otrSm.doProcessTlv(tlv))
                                    return null;
                        }
                    }
                }
                return decryptedMsgContent;
eighthave commented 9 years ago

pure-python-otr does return the plain text when TLVs are present: https://github.com/python-otr/pure-python-otr/blob/1.0.1/src/potr/crypt.py#L190

eighthave commented 9 years ago

as far as I understood the libotr code, it also returns the plain text when TLVs are present, but I could be wrong there.