Libc: ignore address argument to TCP sendto

Generic code that operates over both UDP and TCP sockets might use
'sendto', but in the case of TCP the destination address ought to be
safely discarded. This seems to be the case for certain DNS software
that operates over both UDP and TCP.

Fix #2807
This commit is contained in:
Ehmry - 2018-05-03 16:14:30 +02:00 committed by Christian Helmuth
parent 2b75445ac1
commit 1097a5c7c2
1 changed files with 1 additions and 1 deletions

View File

@ -666,7 +666,7 @@ static ssize_t do_sendto(Libc::File_descriptor *fd,
/* TODO ECONNRESET */
try {
if (dest_addr) {
if (dest_addr && context->proto() == Context::Proto::UDP) {
try {
Sockaddr_string addr_string(host_string(*(sockaddr_in const *)dest_addr),
port_string(*(sockaddr_in const *)dest_addr));