diff --git a/change/react-native-windows-c50e7256-4b11-4efc-87e2-9141b010dee9.json b/change/react-native-windows-c50e7256-4b11-4efc-87e2-9141b010dee9.json new file mode 100644 index 00000000000..292b4beea76 --- /dev/null +++ b/change/react-native-windows-c50e7256-4b11-4efc-87e2-9141b010dee9.json @@ -0,0 +1,7 @@ +{ + "type": "prerelease", + "comment": "Validate arguements for OriginPolicyHttpFilter", + "packageName": "react-native-windows", + "email": "66076509+vineethkuttan@users.noreply.github.com", + "dependentChangeType": "patch" +} \ No newline at end of file diff --git a/vnext/Shared/Networking/OriginPolicyHttpFilter.cpp b/vnext/Shared/Networking/OriginPolicyHttpFilter.cpp index 4ae3c1a47be..689f01735f3 100644 --- a/vnext/Shared/Networking/OriginPolicyHttpFilter.cpp +++ b/vnext/Shared/Networking/OriginPolicyHttpFilter.cpp @@ -43,6 +43,13 @@ namespace Microsoft::React::Networking { #pragma region CaseInsensitiveComparer bool OriginPolicyHttpFilter::CaseInsensitiveComparer::operator()(const wchar_t *a, const wchar_t *b) const { + if (a == b) + return false; + // Validate a, b before calling _wcsicmp + if (a == nullptr) + return false; + if (b == nullptr) + return true; return _wcsicmp(a, b) < 0; }