Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
Use of snprintf and vsnprintf in Curl #3296
The curl code base use
However, there is a notable difference in what
Looking at few cases where
This can be a problem if
This can also cause confusion to folks from outside of the Curl project who review or contribute to the code of the project.
The explicit use of
Since the function returns another return value I think I would prefer to change the function name in all places so that we can check it and fail if the wrong function name is used when code gets changed in the future and possibly start to use the return code. I'll file a PR.
The function does not return the same value as snprintf() normally does, so readers may be mislead into thinking the code works differently than it actually does. A different function name makes this easier to detect. This also adds snprintf() and vsnprintf() is "banned" functions in checksrc to make us not mistakenly use them going forward. Reported-by: Tomas Hoger Assisted-by: Daniel Gustafsson Fixes #3296
One more observation regarding
Repeating the test from:
for curl, the output is: