Add a check to the receive buffer length check to fix an error where it wasn't calculated correctly.