Fix EDB memory overrun bug