diff options
| author | 5an7y-Microsoft <[email protected]> | 2026-05-21 12:50:22 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-05-21 12:50:22 -0700 |
| commit | c7ad9e81acd5d28f339c7f007d6bc9d7ff24f7aa (patch) | |
| tree | f2bf8d77226650510c7ae6ad9f96a3537425e384 | |
| parent | fbc865886f748fbd5d7f01e1bd497a667bd8ca03 (diff) | |
| parent | 972ecc3c9d15e04a15efd3ba7082712cc86c11ad (diff) | |
Merge pull request #1386 from andremueiot/user/andremueiot/multiplication_converted_to_larger_type
NDIS: Harden QoS bytes calculation in netvmini control path
| -rw-r--r-- | network/ndis/netvmini/6x/ctrlpath.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/network/ndis/netvmini/6x/ctrlpath.c b/network/ndis/netvmini/6x/ctrlpath.c index 6a745a36..f6131196 100644 --- a/network/ndis/netvmini/6x/ctrlpath.c +++ b/network/ndis/netvmini/6x/ctrlpath.c @@ -20,6 +20,7 @@ Abstract: #include "netvmin6.h" +#include <ntintsafe.h> #include "ctrlpath.tmh" @@ -1671,6 +1672,9 @@ Return Value: do { + ULONG ClassificationBytes = 0; + ULONG BytesRead = 0; + // // Verify that the request matches our requirements. // @@ -1681,8 +1685,18 @@ Return Value: // // Request is well formed, set bytes read. // - Method->BytesRead = NDIS_SIZEOF_QOS_PARAMETERS_REVISION_1 + - Params->NumClassificationElements * Params->ClassificationElementSize; + if (!NT_SUCCESS(RtlULongMult(Params->NumClassificationElements, + Params->ClassificationElementSize, + &ClassificationBytes)) || + !NT_SUCCESS(RtlULongAdd(NDIS_SIZEOF_QOS_PARAMETERS_REVISION_1, + ClassificationBytes, + &BytesRead))) + { + Status = NDIS_STATUS_INVALID_LENGTH; + break; + } + + Method->BytesRead = BytesRead; Status = SetQOSParameters(Adapter, Params); if (Status != NDIS_STATUS_SUCCESS) |
