Skip to content
This repository has been archived by the owner on Sep 18, 2021. It is now read-only.

fix (and test) for encoding submit_sm_resp messages with no message_id #31

Merged
merged 1 commit into from
Oct 10, 2013

Conversation

chadselph
Copy link
Contributor

Working with a provider who leaves off the message_id in error submit_sm_resp, I noticed that the PDUEncoder was throwing a ArrayIndexOutOfBounds exception when trying to append a \0 byte to the buffer.

Digging deeper, it seems this is actually acceptable behavior according to SMPP 3.4 (but not 3.3 or 5.0):

http://en.wikipedia.org/wiki/Short_Message_Peer-to-Peer#submit_sm_resp_incompatibility_between_SMPP_versions

It seems like some places in the code already account for this ambiguity, but the PDUEncoder did not.

There is one edge case this fix does not cover, but I do not think it is important. Consider a submit_sm_resp with a non-0 status, an omitted message_id, and the existence of optional parameters. In this situation, I maintain that it's not always possible to disambiguate between when the message_id null-terminated-string ends and when the optional parameters begin; it seems like an oversight of the 3.4 spec.

@jjlauer jjlauer merged commit 5ded34a into twitter-archive:master Oct 10, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants