File tree Expand file tree Collapse file tree 3 files changed +6
-2
lines changed
System.Management.Automation/engine/remoting/fanin Expand file tree Collapse file tree 3 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -558,6 +558,10 @@ dotnet_diagnostic.CA2015.severity = warning
558
558
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2016
559
559
dotnet_diagnostic.CA2016.severity = suggestion
560
560
561
+ # CA2020: Prevent behavioral change caused by built-in operators of IntPtr/UIntPtr
562
+ # https://learn.microsoft.com/en-gb/dotnet/fundamentals/code-analysis/quality-rules/ca2020
563
+ dotnet_diagnostic.CA2020.severity = warning
564
+
561
565
# CA2100: Review SQL queries for security vulnerabilities
562
566
# https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca2100
563
567
dotnet_diagnostic.CA2100.severity = none
Original file line number Diff line number Diff line change @@ -1121,7 +1121,7 @@ internal WSManOptionSet(WSManOption[] options)
1121
1121
// Look at the structure of native WSManOptionSet.. Options is a pointer..
1122
1122
// In C-Style array individual elements are continuous..so I am building
1123
1123
// continuous array elements here.
1124
- Marshal . StructureToPtr ( options [ index ] , ( IntPtr ) ( _optionSet . options . ToInt64 ( ) + ( sizeOfOption * index ) ) , false ) ;
1124
+ Marshal . StructureToPtr ( options [ index ] , _optionSet . options + ( sizeOfOption * index ) , false ) ;
1125
1125
}
1126
1126
1127
1127
_data = MarshalledObject . Create < WSManOptionSetStruct > ( _optionSet ) ;
Original file line number Diff line number Diff line change @@ -116,7 +116,7 @@ private static void AttemptExecPwshLogin(string[] args)
116
116
// Read the symlink to the startup executable
117
117
IntPtr linkPathPtr = Marshal . AllocHGlobal ( LINUX_PATH_MAX ) ;
118
118
IntPtr bufSize = ReadLink ( "/proc/self/exe" , linkPathPtr , ( UIntPtr ) LINUX_PATH_MAX ) ;
119
- pwshPath = Marshal . PtrToStringAnsi ( linkPathPtr , ( int ) bufSize ) ;
119
+ pwshPath = Marshal . PtrToStringAnsi ( linkPathPtr , checked ( ( int ) bufSize ) ) ;
120
120
Marshal . FreeHGlobal ( linkPathPtr ) ;
121
121
122
122
ArgumentNullException . ThrowIfNull ( pwshPath ) ;
You can’t perform that action at this time.
0 commit comments