-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[Feature Request] Replace sprintf with snprintf #617
Comments
sprintf and snprintf are both forbidden by MISRA rule 21.6. The intent is for the kernel to be fully MISRA compliant without exceptions. These print functions are used in the optional runtime statistics functions to fill a user supplied string buffer. |
I believe that this library provides a MISRA compliant alternative to |
The only instances of |
@Hadatko Are you using the Otherwise... The parameter(s) of the API of Approach 1
/* ... getting task status with uxTaskGetSystemState ... */
#ifdef configTASK_WRITE_BUFFER_LENGTH
{
sprintf( pcWriteBuffer, "\t%c\t%u\t%u\t%u\r\n", ... );
}
#else
{
snprintf( pcWriteBuffer, configTASK_WRITE_BUFFER_LENGTH, "\t%c\t%u\t%u\t%u\r\n", ... );
}
#endif Approach 2We manually write to the buffer without using any @Hadatko if you are using |
Added macro |
HI guys. Sorry for not being answering. I am not directly using mentioned functions. But i found configUSE_STATS_FORMATTING_FUNCTIONS set to 1. Now i putted it to 0 (thank you for heads up). I posted it here as i am using this RTOS so i wanted report issue once noticed ;) Thank you for your PR. It is great that you want solve this issue ;) |
Is your feature request related to a problem? Please describe.
Hello, newer compilers are starting to complain related to usage of sprintf function (clang returning warning about deprecation). Their are suggesting to replace that call with snprintf. May you consider align your code?
Describe the solution you'd like
Replace sprintf with snprintf
Describe alternatives you've considered
How many devices will this feature impact?
What are your project timelines?
Additional context
If you have the same (or similar) feature request, please upvote this issue with thumbs up 👍
and use the comments section to provide answers to the questions above.
The text was updated successfully, but these errors were encountered: