소스 검색

Merge pull request #2264 from binorxin/main

fix: cast size to int64 before comparing with MaxUint32
Seefs 1 개월 전
부모
커밋
bd9e23ce4e
1개의 변경된 파일2개의 추가작업 그리고 2개의 파일을 삭제
  1. 2 2
      relay/channel/volcengine/protocols.go

+ 2 - 2
relay/channel/volcengine/protocols.go

@@ -385,7 +385,7 @@ func (m *Message) writeSessionID(buf *bytes.Buffer) error {
 	}
 
 	size := len(m.SessionID)
-	if size > math.MaxUint32 {
+	if int64(size) > math.MaxUint32 {
 		return fmt.Errorf("session ID size (%d) exceeds max(uint32)", size)
 	}
 
@@ -407,7 +407,7 @@ func (m *Message) writeErrorCode(buf *bytes.Buffer) error {
 
 func (m *Message) writePayload(buf *bytes.Buffer) error {
 	size := len(m.Payload)
-	if size > math.MaxUint32 {
+	if int64(size) > math.MaxUint32 {
 		return fmt.Errorf("payload size (%d) exceeds max(uint32)", size)
 	}