Re: [RFC PATCH-for-5.2 0/2] net: Do not accept packets with invalid huge size

2020-11-30 Thread Philippe Mathieu-Daudé
On 11/28/20 9:59 PM, Peter Maydell wrote: > On Fri, 27 Nov 2020 at 15:45, Philippe Mathieu-Daudé > wrote: >> >> Hi, >> >> This is a simple attempt to avoid the following pattern: >> >> ssize_t pkt_size = get_pkt_size(); // returns errno >> >> // no check >> >> send_packet(size_t size=pkt_si

Re: [RFC PATCH-for-5.2 0/2] net: Do not accept packets with invalid huge size

2020-11-28 Thread Peter Maydell
On Fri, 27 Nov 2020 at 15:45, Philippe Mathieu-Daudé wrote: > > Hi, > > This is a simple attempt to avoid the following pattern: > > ssize_t pkt_size = get_pkt_size(); // returns errno > > // no check > > send_packet(size_t size=pkt_size); // size casted to unsigned >

Re: [RFC PATCH-for-5.2 0/2] net: Do not accept packets with invalid huge size

2020-11-27 Thread Philippe Mathieu-Daudé
On 11/27/20 4:45 PM, Philippe Mathieu-Daudé wrote: > Hi, > > This is a simple attempt to avoid the following pattern: > > ssize_t pkt_size = get_pkt_size(); // returns errno Sorry, I meant: returns "-errno" (< 0). > > // no check > > send_packet(size_t size=pkt_size); // size casted to

[RFC PATCH-for-5.2 0/2] net: Do not accept packets with invalid huge size

2020-11-27 Thread Philippe Mathieu-Daudé
Hi, This is a simple attempt to avoid the following pattern: ssize_t pkt_size = get_pkt_size(); // returns errno // no check send_packet(size_t size=pkt_size); // size casted to unsigned // -> overflow Regards, Phil. Philippe Mathieu-Daudé (2): ne