diff options
author | Alin Serdean <aserdean@cloudbasesolutions.com> | 2017-11-06 17:33:35 +0200 |
---|---|---|
committer | Alin Gabriel Serdean <aserdean@ovn.org> | 2017-11-29 16:51:12 +0200 |
commit | 960b789f59690c9d59f20473962c61a0f8b38176 (patch) | |
tree | 2123146752263098149cf2303f770b1408777730 | |
parent | d3beb55e7f27c93439491fbf489118a8fde77237 (diff) | |
download | openvswitch-960b789f59690c9d59f20473962c61a0f8b38176.tar.gz |
datapath-windows: Vport check RtlStringCbLengthW return value
The result of `RtlStringCbLengthW` is not currently checked and triggers
a warning using the WDK 8.1 static analysis.
This patch treats the result of `RtlStringCbLengthW`.
Signed-off-by: Alin Gabriel Serdean <aserdean@cloudbasesolutions.com>
Acked-by: Shashank Ram <shashank08@gmail.com>
-rw-r--r-- | datapath-windows/ovsext/Vport.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/datapath-windows/ovsext/Vport.c b/datapath-windows/ovsext/Vport.c index 075f4199a..7cf2497e3 100644 --- a/datapath-windows/ovsext/Vport.c +++ b/datapath-windows/ovsext/Vport.c @@ -1144,8 +1144,13 @@ GetNICAlias(PNDIS_SWITCH_NIC_PARAMETERS nicParam, if (status == STATUS_SUCCESS) { RtlStringCbPrintfW(portFriendlyName->String, IF_MAX_STRING_SIZE, L"%s", interfaceName); - RtlStringCbLengthW(portFriendlyName->String, IF_MAX_STRING_SIZE, - &len); + status = RtlStringCbLengthW(portFriendlyName->String, + IF_MAX_STRING_SIZE, &len); + if (!NT_SUCCESS(status)) { + OVS_LOG_ERROR("Failed to get the length of the string," + "status: %x", status); + return status; + } portFriendlyName->Length = (USHORT)len; } else { OVS_LOG_ERROR("Fail to convert interface LUID to alias, status: %x", |