libgphoto2/libgphoto2-ptp-crash-on-no-card.patch

18 lines
559 B
Diff

http://sourceforge.net/p/gphoto/bugs/945/
diff -up libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c~ libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c
--- libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c~ 2013-01-27 19:17:03.000000000 +0100
+++ libgphoto2-2.5.1.1/camlibs/ptp2/ptp.c 2013-05-04 11:21:32.558255859 +0200
@@ -1877,6 +1877,11 @@ ptp_canon_eos_getobjectinfoex (
if (ret != PTP_RC_OK)
return ret;
+ if (!data) {
+ *nrofentries = 0;
+ return PTP_RC_OK;
+ }
+
*nrofentries = dtoh32a(data);
*entries = malloc(*nrofentries * sizeof(PTPCANONFolderEntry));
if (!*entries)