Browse Source

ensure cipher memory safety

Julien Schmidt 12 years ago
parent
commit
afd9edcd26
1 changed files with 5 additions and 1 deletions
  1. 5 1
      packets.go

+ 5 - 1
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