Details
Description
The order of fromString() is parseHeader(),parseBody(dd),parseTrailer(dd).
Problem 1:
When extracting header, if a body/trailer's field appears in header, the field will be pushed to body and the extraction end up. This field will be considered
as the first field of the body. This will cause Other fields followed dropped.
Problem 2:
When extracting body, if a trailer's field appers in it, it's the same as problem 1.
Problem 3:
When extracting body, if a header's field appers in it, it will be set back into the header. In this case, the header's field could be set in the body which cannot be validated.
e.g. This message can be received.
8=IMIX.1.09=15335=D11=00034=84049=ICBC50=operator00152=20071207-
10:06:38.50556=XXX11=12344=148=asd54=155=WAKEN354=7355=12\001493=711=99989=memory10=XXX
Solution :
In parseBody():
If headerfield is set in body or bodyfield is set in header, throw exception.
If the field has been set in head, throw exception.
In parseTrailer():
If the field has been set in head/body, throw exception.
If trailerfield is set in header/body; or header/body field is set in trailer, throw exception.