summaryrefslogtreecommitdiff
path: root/tftpd/tftpd.c
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2015-08-07 11:49:13 -0700
committerH. Peter Anvin <hpa@zytor.com>2015-08-07 11:49:13 -0700
commit7678ae7f14e5aa6792c4486d4eedcb2db887872c (patch)
treeaa096f1a99486dca86fea3dea8c10cc5d7650728 /tftpd/tftpd.c
parentff819b108a14f40612ebfb15937ae4a1b632bab9 (diff)
downloadtftp-hpa-7678ae7f14e5aa6792c4486d4eedcb2db887872c.tar.gz
tftpd: Canonicalize all the addresses
We cannot canonicalize myaddr and not the from address. We need to canonicalize both of them, or else we'll try to create an IPv4 socket and bind an IPv6-mapped IPv4 address to it, which is going to fail. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'tftpd/tftpd.c')
-rw-r--r--tftpd/tftpd.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/tftpd/tftpd.c b/tftpd/tftpd.c
index 91f5ae1..364e7d2 100644
--- a/tftpd/tftpd.c
+++ b/tftpd/tftpd.c
@@ -93,7 +93,6 @@ static unsigned int max_blksize = MAX_SEGSIZE;
static char tmpbuf[INET6_ADDRSTRLEN], *tmp_p;
static union sock_addr from;
-static socklen_t fromlen;
static off_t tsize;
static int tsize_ok;
@@ -874,9 +873,7 @@ int main(int argc, char **argv)
set_socket_nonblock(fd, 0);
#endif
- fromlen = sizeof(from);
- n = myrecvfrom(fd, buf, sizeof(buf), 0,
- (struct sockaddr *)&from, &fromlen, &myaddr);
+ n = myrecvfrom(fd, buf, sizeof(buf), 0, &from, &myaddr);
if (n < 0) {
if (E_WOULD_BLOCK(errno) || errno == EINTR) {