Skip to content

Commit

Permalink
on printing out MTP variables, check if its the correct type (AFL)
Browse files Browse the repository at this point in the history
  • Loading branch information
msmeissn committed Dec 26, 2016
1 parent f354203 commit 53b7279
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion camlibs/ptp2/ptp.c
Original file line number Diff line number Diff line change
Expand Up @@ -5665,9 +5665,14 @@ ptp_render_property_value(PTPParams* params, uint16_t dpc,
switch (dpc) {
case PTP_DPC_MTP_SynchronizationPartner:
case PTP_DPC_MTP_DeviceFriendlyName:
return snprintf(out, length, "%s", dpd->CurrentValue.str);
if (dpd->DataType == PTP_DTC_STR)
return snprintf(out, length, "%s", dpd->CurrentValue.str);
else
return snprintf(out, length, "invalid type, expected STR");
case PTP_DPC_MTP_SecureTime:
case PTP_DPC_MTP_DeviceCertificate: {
if (dpd->DataType != PTP_DTC_AUINT16)
return snprintf(out, length, "invalid type, expected AUINT16");
/* FIXME: Convert to use unicode demux functions */
for (i=0;(i<dpd->CurrentValue.a.count) && (i<length);i++)
out[i] = dpd->CurrentValue.a.v[i].u16;
Expand Down

0 comments on commit 53b7279

Please sign in to comment.