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

Change 'sprintf' to 'snprintf' to Fix Compiler Warning #63

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

OliverGlandberger
Copy link
Contributor

@OliverGlandberger OliverGlandberger commented Jan 28, 2025

TL;DR


This PR fixes the compiler warning that occurs due to the following line of code:
sprintf(maErrorStr, "No packet received. %s.", maErrorStr);


Problem

Simply adding "No packet received. %.*s" to maErrorStr results in a warning, regardless of how large the static-array member variable is.


Warning Issues


Initially I attempted to rectify the warning by changing to the following:
snprintf(maErrorStr, 1060, "No packet received. %s.", maErrorStr);
However, this resulted in the following output:
image


Building with Ubuntu Terminal


image

@OliverGlandberger OliverGlandberger marked this pull request as ready for review January 28, 2025 16:22
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

Successfully merging this pull request may close these issues.

1 participant