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

Suppress error in snprintf with a pointer variable (IDFGH-12441) #271

Closed
wants to merge 1 commit into from

Conversation

gonzalop
Copy link

Suppresses the following error:
lib/mqtt5_msg.c:767:17: error: null destination pointer [-Werror=format-truncation=]
767 | snprintf(response_topic, response_topic_size, "%s/%s", property->response_topic, resp_info);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Suppresses the following error:
lib/mqtt5_msg.c:767:17: error: null destination pointer [-Werror=format-truncation=]
  767 |                 snprintf(response_topic, response_topic_size, "%s/%s", property->response_topic, resp_info);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@github-actions github-actions bot changed the title Suppress error in snprintf with a pointer variable Suppress error in snprintf with a pointer variable (IDFGH-12441) Mar 24, 2024
@euripedesrocha
Copy link
Collaborator

Hi @gonzalop could you share your configuration? (IDF version, esp_mqtt in use)
Also, your build configuration to trigger this?
I'm trying to reproduce to check if 1edd167 is also a fix for this.

@gonzalop
Copy link
Author

gonzalop commented Apr 4, 2024

I can't reproduce it now :-?. The error is legit when -Werror is on, but I have no idea why it doesn't happen now.. What might have "fixed" it for me is that I switched from Debian trixie to Debian sid a few days ago

That patch you linked would fix the issue too.

Here is the IDF version and my MQTT configuration anyway:

$ idf.py --version
ESP-IDF v5.2.1

And the idf.py menuconfig options for MQTT:

[*] Enable MQTT protocol 3.1.1
[*] Enable MQTT protocol 5.0
[*] Enable MQTT over SSL
[*] Enable MQTT over Websocket
[*]     Enable MQTT over Websocket Secure
[ ] Use Incremental Message Id
[ ] Skip publish if disconnected
[ ] Report deleted messages
[ ] MQTT Using custom configurations
[ ] Enable MQTT task core selection
[ ] Enable custom outbox implementation

@euripedesrocha
Copy link
Collaborator

@gonzalop thanks for the info, what about the build configuration? The error/warning is there without the changes I mention, I just wanted to trigger it and confirm that it's fixed, I agree that the changes must fix, but I would like to have it triggered anyway.
I will close this one, since 1edd167 fix the actual bug here.

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