Skip to content

Commit d859001

Browse files
TylerMSFTTylerMSFT
authored andcommitted
acrolinx
1 parent 7e75cb8 commit d859001

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

docs/code-quality/c26832.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Warning C26832
33
description: "Describes the Microsoft C/C++ code analysis warning C26832, its causes, and how to address it."
4-
ms.date: 03/06/2023
4+
ms.date: 03/20/2023
55
f1_keywords: ["C26832", "ALLOCATION_POTENTIAL_OVERFLOW_AFTER_CAST"]
66
helpviewer_keywords: ["C26832"]
77
---

docs/code-quality/c26833.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Warning C26833
33
description: "Describes the Microsoft C/C++ code analysis warning C26833, its causes, and how to address it."
4-
ms.date: 03/06/2023
4+
ms.date: 03/20/2023
55
f1_keywords: ["C26833", "ALLOCATION_POTENTIAL_OVERFLOW_BEFORE_CHECK"]
66
helpviewer_keywords: ["C26833"]
77
---
@@ -11,7 +11,7 @@ helpviewer_keywords: ["C26833"]
1111
1212
## Remarks
1313

14-
This waraning reports that the size specified for an allocation may be the result of a numerical overflow. For example:
14+
This warning reports that the size specified for an allocation may be the result of a numerical overflow. For example:
1515

1616
```cpp
1717
void* SmallAlloc(int);
@@ -30,7 +30,7 @@ void foo(unsigned i, unsigned j)
3030
}
3131
```
3232
33-
The check for `size > 50` is too late. If `i + j` overflows, it produces a small value that will pass the check. Then, `SmallAlloc` will allocate a buffer smaller than expected. That will likely lead to out of bounds attempts to access the buffer later on. This code pattern can result in remote code execution vulnerabilities.
33+
The check for `size > 50` is too late. If `i + j` overflows, it produces a small value that passes the check. Then, `SmallAlloc` allocates a buffer smaller than expected. That will likely lead to out of bounds attempts to access the buffer later on. This code pattern can result in remote code execution vulnerabilities.
3434
3535
This check applies to common allocation functions like `new`, `malloc`, and `VirtualAlloc`. The check also applies to custom allocator functions that have `alloc` (case insensitive) in the function name.
3636
@@ -40,7 +40,7 @@ This warning is available in Visual Studio 2022 version 17.7 and later versions.
4040
4141
## Example
4242
43-
To fix the previous code example, make sure `i+j` cannot overflow. For example:
43+
To fix the previous code example, make sure `i+j` can't overflow. For example:
4444
4545
```cpp
4646
void* SmallAlloc(int);

docs/code-quality/c26835.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ helpviewer_keywords: ["C26835"]
1111
1212
## Remarks
1313

14-
When `RtlCompareMemory`'s return value is treated as a boolean, it evaluates to true when there is at least 1 equal byte before finding a difference. Moreover, comparing the result of `RtlCompareMemory` to 0 evaluates to false if there is at least 1 matching byte. This behavior may be unexpected because it is different from other comparison functions such as `strcmp`, making the code harder to understand. To check for equality, consider using `RtlEqualMemory` instead.
14+
When `RtlCompareMemory`'s return value is treated as a boolean, it evaluates to true when there is at least 1 equal byte before finding a difference. Moreover, comparing the result of `RtlCompareMemory` to 0 evaluates to false if there is at least 1 matching byte. This behavior may be unexpected because it's different from other comparison functions such as `strcmp`, making the code harder to understand. To check for equality, consider using `RtlEqualMemory` instead.
1515

1616
This warning is available in Visual Studio 2022 version 17.7 and later versions.
1717

@@ -41,5 +41,5 @@ int foo(const void* ptr)
4141

4242
## See also
4343

44-
[`RtlEqualMemory` macro (`wdm.h`)](/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlequalmemory.md)\
45-
[`RtlCompareMemory` function (`wdm.h`)](/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlequalmemory.md)
44+
[`RtlEqualMemory` macro (`wdm.h`)](https://learn.microsoft.com/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlequalmemory)\
45+
[`RtlCompareMemory` function (`wdm.h`)](https://learn.microsoft.com/windows-hardware/drivers/ddi/wdm/nf-wdm-rtlcomparememory)

0 commit comments

Comments
 (0)