core: handle disconnect pdu better, avoid reading past end of buffer