Skip to content

Commit

Permalink
Merge pull request go-sql-driver#190 from go-sql-driver/cipher_memsafe
Browse files Browse the repository at this point in the history
ensure cipher memory safety
  • Loading branch information
julienschmidt committed Dec 8, 2013
2 parents 313606f + afd9edc commit b1aa46e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packets.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,13 @@ func (mc *mysqlConn) readInitPacket() ([]byte, error) {
// return
//}
//return errMalformPkt
return cipher, nil
}

return cipher, nil
// make a memory safe copy of the cipher slice
var b [8]byte
copy(b[:], cipher)
return b[:], nil
}

// Client Authentication Packet
Expand Down

0 comments on commit b1aa46e

Please sign in to comment.