Re: [Qemu-devel] [PATCH 1/2] usb: fix unbound stack usage for usb_mtp_add_str

2016-03-09 Thread Peter Xu
On Thu, Mar 10, 2016 at 09:54:41AM +0800, Fam Zheng wrote: > On Wed, 03/09 14:10, Peter Xu wrote: > > +wchar_t *wstr = g_malloc(sizeof(wchar_t) * len); > > I think it is better to use g_new() in this case. Okay. Will re-send this one. Thanks. Peter

Re: [Qemu-devel] [PATCH 1/2] usb: fix unbound stack usage for usb_mtp_add_str

2016-03-09 Thread Fam Zheng
On Wed, 03/09 14:10, Peter Xu wrote: > Use heap instead of stack. > > Signed-off-by: Peter Xu > --- > hw/usb/dev-mtp.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c > index 7391783..cf63fd0 100644 > --- a/hw/usb/dev-mtp.c > +++ b

[Qemu-devel] [PATCH 1/2] usb: fix unbound stack usage for usb_mtp_add_str

2016-03-08 Thread Peter Xu
Use heap instead of stack. Signed-off-by: Peter Xu --- hw/usb/dev-mtp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index 7391783..cf63fd0 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -718,7 +718,7 @@ static void usb_mtp_a