diff options
author | Daniel P. Berrangé <berrange@redhat.com> | 2019-04-15 16:45:01 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2019-05-02 08:29:33 +0200 |
commit | 3541cd48f32233dd0c0766a3f342e3fd64b04381 (patch) | |
tree | fcb6c02f579946148917d76be0a3ea2aefe1415f /hw/usb | |
parent | f75d15231e56cb0f2bafe19faf1229c459a60731 (diff) |
usb-mtp: fix string length for filename when writing metadata
The ObjectInfo 'length' field provides the length of the
wide character string filename. This is then converted to
a multi-byte character string. This may have a different
byte count to the wide character string. We should use the
C string length of the multi-byte string instead.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20190415154503.6758-2-berrange@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/usb')
-rw-r--r-- | hw/usb/dev-mtp.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 99548b012d..6b7d1296e4 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -1721,7 +1721,7 @@ static void usb_mtp_write_metadata(MTPState *s, uint64_t dlen) return; } - o = usb_mtp_object_lookup_name(p, filename, dataset->length); + o = usb_mtp_object_lookup_name(p, filename, -1); if (o != NULL) { next_handle = o->handle; } |