![]() |
![]() |
2845 | ![]() |
||||
![]() | |||||||
| Arrays | |||||||
Certain standard library functions specify a maximum number (M) of characters to be written to a char array (A).
| function | A parameter number | M parameter number |
|---|---|---|
| asctime_s | 1 | 2 |
| ctime_s | 1 | 2 |
| snprintf | 1 | 2 |
| snprintf_s | 1 | 2 |
| strcpy_s | 1 | 2 |
| strncat | 1 | 3 |
| strncat_s | 1 | 2 |
| strncat_s | 1 | 4 |
| strncat_s | 3 | 4 |
| strncpy | 1 | 3 |
| strncpy_s | 1 | 4 |
/*PRQA S 1-9999 ++*/
/*PRQA S 2845 --*/
#include <string.h>
extern char a[10];
extern char b[11];
void foo (void)
{
strncpy (a, b, sizeof (b)); /* 2845 */
}
MISRA C:2012 Rules applicable to message 2845:
| Dir-4.1 (Required) | Run-time failures shall be minimized |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0 © 2012 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index | Contents |