Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

connackData generates faulty return codes on some systems #146

Open
joncard1 opened this issue Jul 29, 2018 · 3 comments
Open

connackData generates faulty return codes on some systems #146

joncard1 opened this issue Jul 29, 2018 · 3 comments
Assignees
Labels
bug fix added A fix has been added, but not yet in a release
Milestone

Comments

@joncard1
Copy link

In MQTTClient.h line 755, a pointer to connackData#rc is passed in to MQTTDeserialize_connack as a pointer to a char. connackData#rc is declared an int. This causes the return code to be written to the lowest address byte in the int. This causes the return codes to be represented as 83886080, 67108864, 50331648, 33554432, and 16777216. Presumably, my system has a different endianess than the developer's.

@joncard1
Copy link
Author

joncard1 commented Nov 2, 2018

Is it appropriate to bump this? It seems a simple problem to fix with a local variable of the correct type and an assignment. Can I submit a pull request? I wanted to give the developers who've worked on this an opportunity to weigh in on why this was done.

@icraggs icraggs self-assigned this Nov 2, 2018
@icraggs
Copy link
Contributor

icraggs commented Nov 2, 2018

More or less an accident. The MQTTPacket library was written first, in C. The first MQTTClient layer was written later in C++ and I used a different data type because that seemed better at the time. I wasn't thinking of the conversion, and where I tested it it worked.

As we have semantic versioning on the projects, changing the external interface to MQTTPacket means bumping the most significant version number, which I didn't want to do just yet.

So please do submit a PR. Thanks. And sorry for the delay in replying - I've had some other projects to take care of too.

@icraggs icraggs added the bug label Nov 2, 2018
@icraggs icraggs added this to the 1.2 milestone Nov 2, 2018
@joncard1
Copy link
Author

joncard1 commented Nov 4, 2018

I'll put in a PR soon. Thanks.

@icraggs icraggs added the fix added A fix has been added, but not yet in a release label Aug 1, 2023
CIPop pushed a commit to CIPop/paho.mqtt.embedded-c that referenced this issue Aug 3, 2023
CIPop pushed a commit to CIPop/paho.mqtt.embedded-c that referenced this issue Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix added A fix has been added, but not yet in a release
Projects
None yet
Development

No branches or pull requests

2 participants