Details
-
Type: Bug
-
Status: Open
-
Priority: Default
-
Resolution: Unresolved
-
Affects Version/s: 1.2.1
-
Fix Version/s: Future Releases
-
Component/s: Engine
-
Labels:None
Description
In the class Message, method extractField(Group group, DataDictionary dataDictionary, FieldMap fields): The length of "sohOffset" is not checked. This will bring about full range of the message received as Message string out of range.
For all the field, if it is dataField, its length must be calculated by the former Field(Except for Tag 89/93). Because the data may contain a SOH.
For example, field 355 is dataField. Its length is in Field 354.
We must check the offset of the dataField is shorter than length of the message, and the offset's next char is SOH.
Add this code into Message.extractField():
//Judge if sohOffset's next char is '\001'.
if(messageData.indexOf('\001', sohOffset) != sohOffset)
throw new InvalidMessage("Wrong length of data field.");
//Judge if sohOffset is shorter than fields.
if(sohOffset > messageData.length())
throw new InvalidMessage("Wrong length of data field.");