Skip to content

Handle invalid NULL at the end of a PDU - #7

Merged
jerith merged 1 commit into
developfrom
feature/issue-7-handle-invalid-null
Oct 15, 2014
Merged

Handle invalid NULL at the end of a PDU#7
jerith merged 1 commit into
developfrom
feature/issue-7-handle-invalid-null

Conversation

@jerith

@jerith jerith commented Oct 15, 2014

Copy link
Copy Markdown

We've seen at least one provider that sends a NULL byte after the short_message field in a deliver_sm PDU.

This is a violation of the SMPP spec, but we should probably handle it more gracefully than assuming it's the start of an optional parameter and exploding because it's too short to be a 16-bit integer.

Comment thread smpp/pdu.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do any kind of log thing here instead?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not without a bunch of other work that's out of scope for this PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have similar prints in other places in this codebase. We really should fix it, but it hasn't been a priority and I don't want it to block this unnecessarily while we have production issues.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I submitted a pull request a few months ago to replace the print statements with logging: #3

It sounds like you're working on some other issues, but let me know later if you're interested in setting up logging and need help.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that, thanks. Unfortunately, the logging situation is a little more complicate than it appears at first glance -- we're using Twisted's logging in the code that calls this, and the interactions with Python's logging require some careful thought.

Also, this project is something that we generally prefer not to touch unless it's absolutely necessary. It currently (mostly) works for us in production and the effort and risk required to clean it up properly are fairly high for the value we'd get from doing it.

Those are embarrassingly bad reasons for basically ignoring your contributions, for which I apologise, but it's the situation we're currently in. :-/

I do plan to look at the logging stuff again when I get some time. Hopefully in the next few weeks.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand. Thanks again for all your work on this package.

@justinvdm

Copy link
Copy Markdown

👍 though I probably don't know enough about SMPP things to review this properly.

@jerith
jerith merged commit 62f2d4a into develop Oct 15, 2014
@jerith
jerith deleted the feature/issue-7-handle-invalid-null branch October 15, 2014 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants