Added workaround for cases where the packet length ends in \xff in JPEG files