![]() |
![]() |
2840 | ![]() |
||||
![]() | |||||||
| Arrays | |||||||
An element outside the bounds of an array is being accessed - either for reading or writing. Behavior will be undefined. For example:
/*PRQA S 488,2017,3120,3132,3199,3203,3408,3447 ++*/
extern int a[10];
extern int foo(void)
{
int r;
r = a[10]; /* 2840 */
a[10] = 0; /* 2840 */
*(a + 10) = 0; /* 2840 */
return r;
}
Certain standard library functions specify that the char
array destination argument shall be large enough to store the
resulting characters including the null terminator.
This message will also be generated for the following functions
where a string literal argument (M) that is too large for
the destination array:
| function | M parameter number |
|---|---|
| snprintf | 3 |
| snprintf_s | 3 |
| sprintf | 2 |
| strcat | 2 |
| strcpy | 2 |
| strftime | 3 |
| strncat | 2 |
| strncpy | 2 |
See also:
![]() | ||
| QA·C Source Code Analyser 8.1.2
© 2013 Programming Research. www.programmingresearch.com | Personality Groups | Glossary | Message Index | Contents |