From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39979) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTpgv-0003FV-3z for qemu-devel@nongnu.org; Mon, 03 Dec 2018 09:59:22 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTpgt-0008PQ-Bo for qemu-devel@nongnu.org; Mon, 03 Dec 2018 09:59:21 -0500 Received: from mail-ot1-x341.google.com ([2607:f8b0:4864:20::341]:38639) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gTpgs-0008OC-Px for qemu-devel@nongnu.org; Mon, 03 Dec 2018 09:59:19 -0500 Received: by mail-ot1-x341.google.com with SMTP id e12so11840948otl.5 for ; Mon, 03 Dec 2018 06:59:18 -0800 (PST) MIME-Version: 1.0 References: <20181203101045.27976-1-kraxel@redhat.com> <20181203101045.27976-2-kraxel@redhat.com> In-Reply-To: <20181203101045.27976-2-kraxel@redhat.com> From: Peter Maydell Date: Mon, 3 Dec 2018 14:59:06 +0000 Message-ID: Content-Type: text/plain; charset="UTF-8" Subject: Re: [Qemu-devel] [PATCH for-3.1 v3 1/2] usb-mtp: fix utf16_to_str List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: QEMU Developers , public@hansmi.ch On Mon, 3 Dec 2018 at 10:15, Gerd Hoffmann wrote: > > Make utf16_to_str return an allocated string. Remove the assumtion that > the number of string bytes equals the number of utf16 chars (which is > only true for ascii chars). Instead call wcstombs twice, once to figure > the storage size and once for the actual conversion (as suggested by the > wcstombs manpage). > > Reported-by: Michael Hanselmann > Signed-off-by: Gerd Hoffmann > --- > hw/usb/dev-mtp.c | 18 ++++++++++++------ > 1 file changed, 12 insertions(+), 6 deletions(-) Reviewed-by: Peter Maydell thanks -- PMM