github-code-scanning[bot] commented on code in PR #2214:
URL: https://github.com/apache/dubbo-go/pull/2214#discussion_r1107184133


##########
protocol/grpc/client.go:
##########
@@ -61,7 +61,17 @@
        // If not, will return NoopTracer.
        tracer := opentracing.GlobalTracer()
        dialOpts := make([]grpc.DialOption, 0, 4)
+
        maxMessageSize, _ := strconv.Atoi(url.GetParam(constant.MessageSizeKey, 
"4"))
+       // if MaxCallRecvMsgSize or MaxCallSendMsgSize is not empty, override 
maxMessageSize
+       maxCallRecvMsgSize := 1024 * 1024 * maxMessageSize
+       if recvMsgSize := url.GetParamInt(constant.MaxCallRecvMsgSize, 0); 
recvMsgSize != 0 {
+               maxCallRecvMsgSize = int(recvMsgSize)

Review Comment:
   ## Incorrect conversion between integer types
   
   Incorrect conversion of a 64-bit integer from [strconv.ParseInt](1) to a 
lower bit size type int without an upper bound check.
   
   [Show more 
details](https://github.com/apache/dubbo-go/security/code-scanning/15)



##########
protocol/grpc/server.go:
##########
@@ -81,15 +83,26 @@
                panic(err)
        }
 
+       maxMessageSize, _ := strconv.Atoi(url.GetParam(constant.MessageSizeKey, 
"4"))
+       // if MaxCallRecvMsgSize or MaxCallSendMsgSize is not empty, override 
maxMessageSize
+       maxServerRecvMsgSize := 1024 * 1024 * maxMessageSize
+       if recvMsgSize := url.GetParamInt(constant.MaxServerRecvMsgSize, 0); 
recvMsgSize != 0 {
+               maxServerRecvMsgSize = int(recvMsgSize)

Review Comment:
   ## Incorrect conversion between integer types
   
   Incorrect conversion of a 64-bit integer from [strconv.ParseInt](1) to a 
lower bit size type int without an upper bound check.
   
   [Show more 
details](https://github.com/apache/dubbo-go/security/code-scanning/17)



##########
protocol/grpc/client.go:
##########
@@ -61,7 +61,17 @@
        // If not, will return NoopTracer.
        tracer := opentracing.GlobalTracer()
        dialOpts := make([]grpc.DialOption, 0, 4)
+
        maxMessageSize, _ := strconv.Atoi(url.GetParam(constant.MessageSizeKey, 
"4"))
+       // if MaxCallRecvMsgSize or MaxCallSendMsgSize is not empty, override 
maxMessageSize
+       maxCallRecvMsgSize := 1024 * 1024 * maxMessageSize
+       if recvMsgSize := url.GetParamInt(constant.MaxCallRecvMsgSize, 0); 
recvMsgSize != 0 {
+               maxCallRecvMsgSize = int(recvMsgSize)
+       }
+       maxCallSendMsgSize := 1024 * 1024 * maxMessageSize
+       if sendMsgSize := url.GetParamInt(constant.MaxCallSendMsgSize, 0); 
sendMsgSize != 0 {
+               maxCallSendMsgSize = int(sendMsgSize)

Review Comment:
   ## Incorrect conversion between integer types
   
   Incorrect conversion of a 64-bit integer from [strconv.ParseInt](1) to a 
lower bit size type int without an upper bound check.
   
   [Show more 
details](https://github.com/apache/dubbo-go/security/code-scanning/16)



##########
protocol/grpc/server.go:
##########
@@ -81,15 +83,26 @@
                panic(err)
        }
 
+       maxMessageSize, _ := strconv.Atoi(url.GetParam(constant.MessageSizeKey, 
"4"))
+       // if MaxCallRecvMsgSize or MaxCallSendMsgSize is not empty, override 
maxMessageSize
+       maxServerRecvMsgSize := 1024 * 1024 * maxMessageSize
+       if recvMsgSize := url.GetParamInt(constant.MaxServerRecvMsgSize, 0); 
recvMsgSize != 0 {
+               maxServerRecvMsgSize = int(recvMsgSize)
+       }
+       maxServerSendMsgSize := 1024 * 1024 * maxMessageSize
+       if sendMsgSize := url.GetParamInt(constant.MaxServerSendMsgSize, 0); 
sendMsgSize != 0 {
+               maxServerSendMsgSize = int(sendMsgSize)

Review Comment:
   ## Incorrect conversion between integer types
   
   Incorrect conversion of a 64-bit integer from [strconv.ParseInt](1) to a 
lower bit size type int without an upper bound check.
   
   [Show more 
details](https://github.com/apache/dubbo-go/security/code-scanning/18)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to