Re: [PATCH] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-01-28 Thread Peter Maydell
On Mon, 27 Jan 2025 at 14:48, Hongren Zheng wrote: > > On Mon, Jan 13, 2025 at 05:38:56PM +0800, Hongren Zheng wrote: > > When USBPacket in OUT direction has larger payload > > than the ep_out_buffer (of size 512), a buffer overflow > > would occur. > > > > It could be fixed by limiting the size o

Re: [PATCH] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-01-27 Thread Hongren Zheng
On Mon, Jan 13, 2025 at 05:38:56PM +0800, Hongren Zheng wrote: > When USBPacket in OUT direction has larger payload > than the ep_out_buffer (of size 512), a buffer overflow > would occur. > > It could be fixed by limiting the size of usb_packet_copy > to be at most buffer size. Further optimizati

[PATCH] hw/usb/canokey: Fix buffer overflow for OUT packet

2025-01-13 Thread Hongren Zheng
When USBPacket in OUT direction has larger payload than the ep_out_buffer (of size 512), a buffer overflow would occur. It could be fixed by limiting the size of usb_packet_copy to be at most buffer size. Further optimization gets rid of the ep_out_buffer and directly uses ep_out as the target buf