Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
Fix bug
Browse files Browse the repository at this point in the history
When parsing an error reply message one character is already
taken into account by the minimum size constant of the message type.
  • Loading branch information
romshark committed Apr 5, 2018
1 parent 917d213 commit c1adf42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions message.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,9 @@ func (msg *Message) parseErrorReply(message []byte) error {

// Verify total message size to prevent segmentation faults caused by inconsistent flags,
// this could happen if the specified error code length
// doesn't correspond to the actual length of the provided error code
if len(message) < MsgMinLenErrorReply+errCodeLen {
// doesn't correspond to the actual length of the provided error code.
// Subtract 1 character already taken into account by MsgMinLenErrorReply
if len(message) < MsgMinLenErrorReply+errCodeLen-1 {
return fmt.Errorf(
"Invalid error reply message, too short for specified code length (%d)",
errCodeLen,
Expand Down

0 comments on commit c1adf42

Please sign in to comment.