From 4d253eaee098949bb3f8d71c3634027cd9388a40 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 4 Mar 2016 19:58:30 +0100 Subject: [PATCH] enforce the type specified in the table (AFL) --- camlibs/ptp2/config.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/camlibs/ptp2/config.c b/camlibs/ptp2/config.c index b016cc6f3..cbddeaa32 100644 --- a/camlibs/ptp2/config.c +++ b/camlibs/ptp2/config.c @@ -7223,6 +7223,11 @@ _get_config (Camera *camera, const char *confname, CameraWidget **outwidget, Cam GP_LOG_D ("Getting property '%s' / 0x%04x", cursub->label, cursub->propid ); memset(&dpd,0,sizeof(dpd)); C_PTP (ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd)); + if (cursub->type != dpd.DataType) { + GP_LOG_E ("Type of property '%s' expected: 0x%04x got: 0x%04x", cursub->label, cursub->type, dpd.DataType ); + ptp_free_devicepropdesc(&dpd); + continue; + } ret = cursub->getfunc (camera, &widget, cursub, &dpd); if ((ret == GP_OK) && (dpd.GetSet == PTP_DPGS_Get)) gp_widget_set_readonly (widget, 1); @@ -7587,6 +7592,11 @@ _set_config (Camera *camera, const char *confname, CameraWidget *window, GPConte memset(&dpd,0,sizeof(dpd)); ptp_generic_getdevicepropdesc(params,cursub->propid,&dpd); + if (cursub->type != dpd.DataType) { + GP_LOG_E ("Type of property '%s' expected: 0x%04x got: 0x%04x", cursub->label, cursub->type, dpd.DataType ); + ptp_free_devicepropdesc(&dpd); + continue; + } if (dpd.GetSet == PTP_DPGS_GetSet) { ret = cursub->putfunc (camera, widget, &propval, &dpd); } else {