You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
631 B

diff -urNp a/camlibs/ptp2/ptp-pack.c b/camlibs/ptp2/ptp-pack.c
--- a/camlibs/ptp2/ptp-pack.c 2019-03-06 10:03:33.493129377 +0100
+++ b/camlibs/ptp2/ptp-pack.c 2019-03-06 10:07:04.136243129 +0100
@@ -136,12 +136,16 @@ ptp_unpack_string(PTPParams *params, uns
size_t nconv, srclen, destlen;
char *src, *dest;
+ *len = 0;
+
if (offset + 1 >= total)
return NULL;
length = dtoh8a(&data[offset]); /* PTP_MAXSTRLEN == 255, 8 bit len */
- if (length == 0) /* nothing to do? */
+ if (length == 0){ /* nothing to do? */
+ *len = 0;
return NULL;
+ }
if (offset + 1 + length*sizeof(string[0]) > total)
return NULL;