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

Uninitlized variable. #24

Closed
jpwsutton opened this issue Feb 4, 2016 · 0 comments
Closed

Uninitlized variable. #24

jpwsutton opened this issue Feb 4, 2016 · 0 comments

Comments

@jpwsutton
Copy link
Member

migrated from Bugzilla #444792
status RESOLVED severity major in component MQTT-Embedded-C for 1.1
Reported in version v0.5 on platform PC
Assigned to: Ian Craggs

On 2014-09-23 02:55:55 -0400, Kamal Baker wrote:

The variable 'c' which is used to read the header bytes from the socket is used before initilization in MQTTPacket_decode. This variable caused the client to believe that there were data to read. The OS used is Freescale MQX with the RTCS stack. The fix is to set the variable to '0' before read in the do/while loop

Regards
Kamal Baker

On 2014-09-23 06:14:15 -0400, Ian Craggs wrote:

The first use of the variable c is to be written to by the function getcharfn, which is why it is not initialized.

The function getcharfn should return 0 or -1 if if fails to read the data, 1 if successful. This is the test that determines whether the network read was successful or not.

We can initialize the variable c, but if getcharfn is behaving as intended, then it will make no difference. Maybe the socket read call on this platform is returning a different value?

On 2015-01-13 05:53:19 -0500, Ian Craggs wrote:

The return code from getcharfn, 0 or -1, determines the success of the read call, not the value in c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant