You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
15
15
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.
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:
23
25
24
26
```cpp
25
27
voidf()
@@ -34,7 +36,7 @@ void f()
34
36
}
35
37
```
36
38
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.
0 commit comments