Skip to content

Commit 3f14b3c

Browse files
Merge pull request #6062 from carsonRadtke/carsonradtke/c6064-doc-improvements
code analysis: improvements to c6064
2 parents 5f8d777 + 03ac7e2 commit 3f14b3c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

docs/code-quality/c6064.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
2-
title: "Warning C6064"
2+
title: Warning C6064
33
description: "Learn more about: Warning C6064"
4-
ms.date: 2/07/2023
4+
ms.date: 9/29/2025
55
f1_keywords: ["C6064", "MISSING_INTEGER_ARGUMENT_TO_FORMAT_FUNCTION", "__WARNING_MISSING_INTEGER_ARGUMENT_TO_FORMAT_FUNCTION"]
66
helpviewer_keywords: ["C6064"]
77
---
@@ -13,13 +13,15 @@ helpviewer_keywords: ["C6064"]
1313

1414
This warning indicates that the code doesn't provide enough arguments to match a format string and one of the missing arguments is an integer.
1515

16-
This defect is likely to cause incorrect output and, in more dangerous cases, can lead to stack overflow.
16+
Providing too few arguments to a format function leads to undefined behavior because the function attempts to read values that aren't passed. Possible consequences include incorrect output, crashes, or even security vulnerabilities such as information leaks.
17+
18+
To ensure stability and safety, always match the number and types of arguments to the format specifiers in the string.
1719

1820
Code analysis name: `MISSING_INTEGER_ARGUMENT_TO_FORMAT_FUNCTION`
1921

2022
## Example
2123

22-
The following code generates this warning because it uses an incorrect number of arguments in the call to `sprintf_s` and the missing argument is an integer. If the unsafe function `sprintf` was used instead of the safer variant `sprintf_s`, this code would likely cause a stack overflow instead of just an unexpected output:
24+
The following code generates this warning by passing the wrong number of arguments to `sprintf_s` and the missing argument is an integer. If the unsafe function `sprintf` was used instead of the safer variant `sprintf_s`, this code would likely cause a stack overflow instead of just unexpected output:
2325

2426
```cpp
2527
void f()
@@ -34,7 +36,7 @@ void f()
3436
}
3537
```
3638

37-
To correct this warning, specify missing arguments or adjust the format string. In this example, we add the missing integer value.
39+
To correct this warning, specify the missing arguments or adjust the format string. In this example, we add the missing integer value.
3840

3941
```cpp
4042
void f()

0 commit comments

Comments
 (0)