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
> warning C28159: Consider using another function instead.
13
-
16
+
> Consider using `\**function_name_1*` instead of `\**function_name_2*`. Reason: `\**reason*`
14
17
This warning is reported for Drivers is suggesting that you use a preferred function call that is semantically equivalent to the function that the driver is calling. This is a general warning message; the annotation `__drv_preferredFunction` was used (possibly with a conditional a `__drv_when`() annotation) to flag a bad coding practice.
18
+
This warning occurs when that you use a function that is semantically equivalent to an alternative, preferred function call.
19
+
20
+
## Remarks
21
+
22
+
This is a general warning message; the annotation `__drv_preferredFunction` was used (possibly with a conditional a `__drv_when`() annotation) to flag a bad coding practice.
23
+
24
+
Code analysis name: USE_OTHER_FUNCTION
15
25
16
26
## Example
17
27
18
28
The following code example generates this warning:
29
+
The following code example generates this warning. This issue is due to the use of `OemToChar`, which does not validate the buffer size:
19
30
20
31
```cpp
21
32
char buff[MAX_PATH];
22
-
23
33
// if strlen(input) > MAX_PATH
24
34
// leads to buffer overrun
35
+
// if strlen(input) > MAX_PATH, this call leads to buffer overrun
25
36
OemToChar(buff, input);
26
37
```
27
38
28
39
The following code example avoids this warning:
40
+
The following code example avoids this warning by using the recommended alternative `OemToCharBuff`, which takes in the destination buffer size and limits the copy appropriatly:
0 commit comments