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

JSON_Read() warning messages enhancements #1817

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

Conversation

davidBar-On
Copy link
Contributor

  • Version of iperf3 (or development branch, such as master or
    3.1-STABLE) to which this pull request applies:
    master

  • Issues fixed (if any): none

  • Brief description of code changes (suitable for use as a commit message):
    Enhancement to the JSON_Read() warning() messages done while evaluating issue iperf3: error - unable to receive parameters from client: Bad file descriptor #1808. I believe that they can help in other situations.

Copy link
Contributor

@bmah888 bmah888 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Just one quick comment so far: it'd probably be better to use snprintf() rather than sprintf() in this patch to limit the number of bytes that get written into msg_buf. So maybe something like snprintf(msg_buf, sizeof(msg_buf), ...

The chance of overflowing msg_buf with the current code is probably zero, but the use of snprintf(3) is generally discouraged and I think some compilers will warn about its usage.

@davidBar-On
Copy link
Contributor Author

... it'd probably be better to use snprintf() rather than sprintf() ...

Changed sprintf() to snprintf()

@bmah888 bmah888 self-assigned this Jan 13, 2025
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.

2 participants