currently if fromlen passed by user is zero the from structure is filled with garbage values. The reason behind is that struct sockaddr_storage bsdaddr is made inside ff_recvfrom() and is passed to kern_recvit() to be filled. kern_recvit() does not touch bsdaddr in case of zero fromlen hence it has garbadge values. Later in freebsd2linux_sockaddr(), bsdaddr is copied into from which corrupts *from.
The fix is to simply not copy bsdaddr into from in case of zero fromlen. This patch adds a simple check for that.
currently if fromlen passed by user is zero the from structure is filled with garbage values. The reason behind is that
struct sockaddr_storage bsdaddr
is made inside ff_recvfrom() and is passed to kern_recvit() to be filled. kern_recvit() does not touch bsdaddr in case of zero fromlen hence it has garbadge values. Later in freebsd2linux_sockaddr(), bsdaddr is copied into from which corrupts *from.The fix is to simply not copy bsdaddr into from in case of zero fromlen. This patch adds a simple check for that.