Skip to content

Fix bounds checking on counter, push notifs timeout - #103

Open
Desdaemon wants to merge 1 commit into
ynoproject:masterfrom
Desdaemon:master
Open

Fix bounds checking on counter, push notifs timeout#103
Desdaemon wants to merge 1 commit into
ynoproject:masterfrom
Desdaemon:master

Conversation

@Desdaemon

Copy link
Copy Markdown
Contributor

No description provided.


func (s *Security) VerifyCounter(counter *uint32, msg []byte) bool {
if cnt := binary.BigEndian.Uint32(msg[4 : len(msg)-4]); *counter < cnt {
if cnt := binary.BigEndian.Uint32(msg[4:]); *counter < cnt {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already guaranteed by processMsgs to be at least 8 bytes long, but limiting it to len(msg)-4 may give a slice shorter than 4 bytes and cause Uint32 to panic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant