Fix buffer overflow in keepalivePacket.