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

Null pointer access if the server URI does not contain a ':' #8

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

Null pointer access if the server URI does not contain a ':' #8

jpwsutton opened this issue Feb 4, 2016 · 3 comments
Assignees
Labels
Milestone

Comments

@jpwsutton
Copy link
Contributor

migrated from Bugzilla #484386
status UNCONFIRMED severity normal in component MQTT-C for 1.2
Reported in version 1.2 on platform PC
Assigned to: Ian Craggs

Original attachment names and IDs:

On 2015-12-15 07:43:27 -0500, Juergen Kosel wrote:

Created attachment 258686
Patch to fix this issue

If the user accidentally provided a bad server URI without port and without ':'
the paho-mqtt library crashes due to null pointer access.
The fix is simple, please look at the attached patch.

JuergenKosel referenced this issue in JuergenKosel/paho.mqtt.c Feb 24, 2016
With this fix MQTTAsync_Create does not fail with -2 any more.

Signed-off-by: Juergen Kosel <juergen.kosel@softing.com>

Conflicts:
	src/MQTTPersistenceDefault.c
@JuergenKosel JuergenKosel mentioned this issue Apr 7, 2016
@icraggs
Copy link
Contributor

icraggs commented May 22, 2016

For this bug, I think we should be ensuring that the port is specified. There is no default port assignment in the API, so not specifying the port in the serverURI is going to fail anyway. With this approach, creating a client without specifying the port will fail with, perhaps with a new -10 return code (BAD_SERVERURI).

@JuergenKosel
Copy link
Contributor

A default port is assigned in file MQTTProtocollOut.c function MQTTProtocol_addressPort().
So it should be okay to not especially specify a port.

@icraggs icraggs added the bug label Jun 1, 2016
@icraggs icraggs added this to the 1.1 milestone Jun 1, 2016
@icraggs icraggs self-assigned this Jun 1, 2016
@icraggs
Copy link
Contributor

icraggs commented Jun 1, 2016

This was fixed in the fix for issue #7 and works in the develop branch.

@icraggs icraggs closed this as completed Jun 1, 2016
@frett27 frett27 mentioned this issue Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants