summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2017-04-22 10:04:46 +0200
committerMarcus Meissner <marcus@jet.franken.de>2017-04-22 10:04:46 +0200
commitd2e7c3a02936cd6fb5c2b7d74130992c95cc58d6 (patch)
tree04ce431523396c82fe91473fb2b5a86d759dbc20
parent93ecd7592db1663eef73754675bf3bd6c972cc7d (diff)
downloadlibgphoto2-d2e7c3a02936cd6fb5c2b7d74130992c95cc58d6.tar.gz
avoid crash if model is NULL
-rw-r--r--camlibs/ptp2/ptp-private.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/camlibs/ptp2/ptp-private.h b/camlibs/ptp2/ptp-private.h
index 2a90fd9c9..1bb6ccc49 100644
--- a/camlibs/ptp2/ptp-private.h
+++ b/camlibs/ptp2/ptp-private.h
@@ -113,7 +113,8 @@ static inline int
is_canon_eos_m(PTPParams *params) {
if (params->deviceinfo.VendorExtensionID != PTP_VENDOR_CANON) return 0;
if (!ptp_operation_issupported(params, PTP_OC_CANON_EOS_SetRemoteMode)) return 0;
- return strstr(params->deviceinfo.Model, "EOS M") != NULL;
+ if (!params->deviceinfo.Model) return 0;
+ return !strncmp(params->deviceinfo.Model, "Canon EOS M", strlen("Canon EOS M"));
}