From e2e03c3078c0fb2066fb340bf8d2ff227a53adbe Mon Sep 17 00:00:00 2001 From: Bruce Marriner Date: Mon, 25 Apr 2016 15:19:23 -0500 Subject: [PATCH] Do not allow sending role colors > 0xFFFFFF --- restapi.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/restapi.go b/restapi.go index 0cf9fc8..f740b42 100644 --- a/restapi.go +++ b/restapi.go @@ -716,6 +716,11 @@ func (s *Session) GuildRoleCreate(guildID string) (st *Role, err error) { // perm : The permissions for the role. func (s *Session) GuildRoleEdit(guildID, roleID, name string, color int, hoist bool, perm int) (st *Role, err error) { + // Prevent sending a color int that is too big. + if color > 0xFFFFFF { + err = fmt.Errorf("color value cannot be larger than 0xFFFFFF") + } + data := struct { Name string `json:"name"` // The color the role should have (as a decimal, not hex) Color int `json:"color"` // Whether to display the role's users separately