one more consistency check

git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14601 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
Marcus Meissner
2013-12-21 14:17:40 +00:00
parent 8a196684e6
commit f2a2cf53ec

View File

@@ -1201,13 +1201,18 @@ ptp_unpack_OPL (PTPParams *params, unsigned char* data, MTPProperties **pprops,
static inline void
ptp_unpack_EC (PTPParams *params, unsigned char* data, PTPContainer *ec, unsigned int len)
{
int length;
unsigned int length;
int type;
if (data==NULL)
return;
memset(ec,0,sizeof(*ec));
length=dtoh32a(&data[PTP_ec_Length]);
if (length > len) {
ptp_debug (params, "length %d in container, but data only %d bytes?!", length, len);
return;
}
type = dtoh16a(&data[PTP_ec_Type]);
ec->Code=dtoh16a(&data[PTP_ec_Code]);