Le 16 juillet 2026 16:00:02 GMT+03:00, Breno Leitao <[email protected]> a écrit : >pep_getsockopt() clamps the reported length to the caller's buffer with >min_t(), but then stores the value with put_user(val, (int __user *) >optval), which always writes sizeof(int) bytes. A getsockopt() call with >an optlen smaller than sizeof(int) thus reports the clamped length yet >writes a full int, one to three bytes past the user buffer. > >Write the value with copy_to_user() bounded by len, so at most optlen >bytes are copied, matching the length reported back to userspace. > >Fixes: 02a47617cdce ("Phonet: implement GPRS virtual interface over PEP >socket") >Signed-off-by: Breno Leitao <[email protected]> Acked-by: Rémi Denis-Courmont <[email protected]>
- [PATCH net-next 0/7] net: convert rawv6, ieee802154, ... Breno Leitao
- [PATCH net-next 1/7] ipv6: raw: drop unused leve... Breno Leitao
- [PATCH net-next 2/7] ipv6: raw: convert do_rawv6... Breno Leitao
- [PATCH net-next 4/7] phonet: pep: do not write b... Breno Leitao
- Re: [PATCH net-next 4/7] phonet: pep: do not... Rémi Denis-Courmont
- [PATCH net-next 5/7] phonet: pep: convert getsoc... Breno Leitao
- Re: [PATCH net-next 5/7] phonet: pep: conver... Rémi Denis-Courmont
- Re: [PATCH net-next 5/7] phonet: pep: conver... David Laight
- Re: [PATCH net-next 5/7] phonet: pep: co... Breno Leitao
- [PATCH net-next 3/7] ieee802154: convert dgram g... Breno Leitao
- [PATCH net-next 6/7] tls: convert getsockopt to ... Breno Leitao
- [PATCH net-next 7/7] selftests: net: getsockopt_... Breno Leitao
- Re: [PATCH net-next 7/7] selftests: net: get... Rémi Denis-Courmont

