From afd9edcd262beabd6925d42d65580d23e646bbfb Mon Sep 17 00:00:00 2001 From: Julien Schmidt Date: Sat, 7 Dec 2013 23:53:58 +0100 Subject: [PATCH] ensure cipher memory safety --- packets.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packets.go b/packets.go index 967dde35f..68f4378d8 100644 --- a/packets.go +++ b/packets.go @@ -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