diff options
Diffstat (limited to 'camlibs/ptp2/usb.c')
-rw-r--r-- | camlibs/ptp2/usb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/camlibs/ptp2/usb.c b/camlibs/ptp2/usb.c index 69525c690..0fe3551b2 100644 --- a/camlibs/ptp2/usb.c +++ b/camlibs/ptp2/usb.c @@ -438,6 +438,12 @@ ptp_usb_getresp (PTPParams* params, PTPContainer* resp) if (ret!=PTP_RC_OK) { ret = PTP_ERROR_IO; } else + if (rlen < 12) { + ret = PTP_ERROR_IO; + } else + if (rlen != dtoh32(usbresp.length)) { + ret = PTP_ERROR_IO; + } else if (dtoh16(usbresp.type)!=PTP_USB_CONTAINER_RESPONSE) { ret = PTP_ERROR_RESP_EXPECTED; } else |