Skip to content

Commit f4fb44c

Browse files
Updated C6064
Clarified comment, removed extra characters
1 parent b86b697 commit f4fb44c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

docs/code-quality/c6064.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ Code analysis name: MISSING_INTEGER_ARGUMENT_TO_FORMAT_FUNCTION
2121

2222
## Example
2323

24-
The following code generates this warning because an incorrect number of arguments were used in call to `sprintf_s` and the missing argument was an integer. Had the unsafe function `sprintf` been used instead of the safer variant `sprintf_s`, this code would likely cause a stack overflow instead of just an expected output:
24+
The following code generates this warning because an incorrect number of arguments were used in the call to `sprintf_s` and the missing argument was an integer. Had the unsafe function `sprintf` been used instead of the safer variant `sprintf_s`, this code would likely cause a stack overflow instead of just an unexpected output:
2525

2626
```cpp
2727
void f()
2828
{
2929
char buff[8];
3030
char *string="Hello";
31-
sprintf_s(buff, sizeof(buff), "%s %d", string); // Attempts to print "Hello 256" or approximate, which cannot fit in the 8 char buffer
31+
sprintf_s(buff, sizeof(buff), "%s %d", string); // Attempts to print "Hello 256" or approximate, which cannot fit in the 8 char buffer. This would overflow if sprintf had been used instead
3232
}
3333
```
3434

0 commit comments

Comments
 (0)