File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -2548,7 +2548,12 @@ func EnumProviders(
25482548 }()
25492549
25502550 if providersCount > 0 {
2551- providerList := (* [1 << 30 ]ncryptProviderName )(unsafe .Pointer (providerListPtr ))[:providersCount :providersCount ]
2551+ count := int (providersCount )
2552+ if count < 0 {
2553+ err = fmt .Errorf ("providersCount exceeds max int on this architecture" )
2554+ return
2555+ }
2556+ providerList := unsafe .Slice ((* ncryptProviderName )(unsafe .Pointer (providerListPtr )), count )
25522557 provsInfo = make ([]NcryptProviderInfo , providersCount )
25532558 for i := range provsInfo {
25542559 provsInfo [i ].fromInternal (providerList [i ])
@@ -2786,7 +2791,12 @@ func (p *Provider) EnumAlgorithms(
27862791 }()
27872792
27882793 if algCount > 0 {
2789- algList := (* [1 << 30 ]ncryptAlgorithmName )(unsafe .Pointer (algListPtr ))[:algCount :algCount ]
2794+ count := int (algCount )
2795+ if count < 0 {
2796+ err = fmt .Errorf ("algCount exceeds max int on this architecture" )
2797+ return
2798+ }
2799+ algList := unsafe .Slice ((* ncryptAlgorithmName )(unsafe .Pointer (algListPtr )), count )
27902800 algsInfo = make ([]NcryptAlgorithmInfo , algCount )
27912801 for i := range algsInfo {
27922802 algsInfo [i ].fromInternal (algList [i ])
You can’t perform that action at this time.
0 commit comments