From: <mar...@us...> - 2008-11-05 19:51:39
|
Revision: 11520 http://gphoto.svn.sourceforge.net/gphoto/?rev=11520&view=rev Author: marcusmeissner Date: 2008-11-05 19:51:36 +0000 (Wed, 05 Nov 2008) Log Message: ----------- fixed the error return cases when MTP Object Proplist is too short. Modified Paths: -------------- trunk/libgphoto2/camlibs/ptp2/ptp-pack.c Modified: trunk/libgphoto2/camlibs/ptp2/ptp-pack.c =================================================================== --- trunk/libgphoto2/camlibs/ptp2/ptp-pack.c 2008-11-05 19:50:01 UTC (rev 11519) +++ trunk/libgphoto2/camlibs/ptp2/ptp-pack.c 2008-11-05 19:51:36 UTC (rev 11520) @@ -995,15 +995,18 @@ *pprops = NULL; return 0; } + ptp_debug (params ,"Unpacking MTP OPL, size %d (prop_count %d)", len, prop_count); data += sizeof(uint32_t); len -= sizeof(uint32_t); props = malloc(prop_count * sizeof(MTPProperties)); if (!props) return 0; for (i = 0; i < prop_count; i++) { if (len <= 0) { - ptp_debug (params ,"short MTP Object Property List at property %d", i); + ptp_debug (params ,"short MTP Object Property List at property %d (of %d)", i, prop_count); ptp_debug (params ,"device probably needs DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST_ALL", i); ptp_debug (params ,"or even DEVICE_FLAG_BROKEN_MTPGETOBJPROPLIST", i); + qsort (props, i, sizeof(MTPProperties),_compare_func); + *pprops = props; return i; } props[i].ObjectHandle = dtoh32a(data); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |