Blob Blame History Raw
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;