Skip to content

Commit

Permalink
fix(cmd/gocq/login.go): fix log output causing index overrun
Browse files Browse the repository at this point in the history
  • Loading branch information
Xiangze-Li committed Sep 8, 2023
1 parent 35f9ae5 commit 55b01b6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cmd/gocq/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,11 @@ func signSubmit(uin string, cmd string, callbackID int64, buffer []byte, t strin
signServer += "/"
}
buffStr := hex.EncodeToString(buffer)
log.Infof("submit %v: uin=%v, cmd=%v, callbackID=%v, buffer-end=%v", t, uin, cmd, callbackID,
buffStr[len(buffStr)-10:])
buffEnd := buffStr[:]
if len(buffEnd) > 10 {

Check failure on line 319 in cmd/gocq/login.go

View workflow job for this annotation

GitHub Actions / lint

undefined: buffEnd
buffEnd = buffEnd[len(buffEnd)-10:]

Check failure on line 320 in cmd/gocq/login.go

View workflow job for this annotation

GitHub Actions / lint

undefined: buffEnd
}
log.Infof("submit %v: uin=%v, cmd=%v, callbackID=%v, buffer-end=%v", t, uin, cmd, callbackID, buffEnd)

Check failure on line 322 in cmd/gocq/login.go

View workflow job for this annotation

GitHub Actions / lint

undefined: buffEnd
_, err := download.Request{
Method: http.MethodGet,
URL: signServer + "submit" + fmt.Sprintf("?uin=%v&cmd=%v&callback_id=%v&buffer=%v",
Expand Down

0 comments on commit 55b01b6

Please sign in to comment.