diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2017-04-22 10:04:46 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2017-04-22 10:04:46 +0200 |
commit | d2e7c3a02936cd6fb5c2b7d74130992c95cc58d6 (patch) | |
tree | 04ce431523396c82fe91473fb2b5a86d759dbc20 | |
parent | 93ecd7592db1663eef73754675bf3bd6c972cc7d (diff) | |
download | libgphoto2-d2e7c3a02936cd6fb5c2b7d74130992c95cc58d6.tar.gz |
avoid crash if model is NULL
-rw-r--r-- | camlibs/ptp2/ptp-private.h | 3 |
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")); } |