数组越界校验

This commit is contained in:
meixiongfeng 2024-02-02 18:22:27 +08:00
parent 16060da96c
commit 87082f6e72
2 changed files with 26 additions and 2 deletions

View File

@ -515,5 +515,27 @@
},
"reword": [],
"duration": 720
},
{
"id": "PlunderRankingReward",
"title": {
"key": "mail_mail_title_24",
"text": "海岛排行奖励"
},
"postmark": "yj_icon_yc_mfjl",
"recipient": {
"key": "mail_mail_recipient_24",
"text": "亲爱的玩家:"
},
"content": {
"key": "mail_mail_content_8",
"text": "获得第{0}名,奖励请查收。"
},
"sender": {
"key": "mail_mail_sender_24",
"text": "系统"
},
"reword": [],
"duration": 720
}
]

View File

@ -171,8 +171,10 @@ func (this *apiComp) sendRankReward(data map[string]int32) (err error) {
var sz []string
if true {
for i := v.ScoreLow; i <= v.ScoreUp; i++ {
if int32(len(uid)) > i-1 { // 越界校验
sz = append(sz, uid[i-1])
}
}
}
for _, v := range v.Reward {
@ -183,7 +185,7 @@ func (this *apiComp) sendRankReward(data map[string]int32) (err error) {
})
}
this.module.mail.SendNewMail(&pb.DBMailData{
Cid: "XXLRankingReward",
Cid: "PlunderRankingReward",
Param: []string{fmt.Sprintf("%d-%d", v.ScoreLow, v.ScoreUp)}, // 参数 分数下线和分数上限之间
CreateTime: uint64(configure.Now().Unix()),
Items: reward,