tftpd: Canonicalize myaddr before address_is_local()

The comparisons for forbidden addresses in address_is_local() only
work on canonicalized addresses.

Also, work in the case myaddr is NULL (if we ever call it that way...)

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2015-08-07 11:55:08 -07:00
parent 7678ae7f14
commit b2b34cecc8

View file

@ -255,6 +255,9 @@ myrecvfrom(int s, void *buf, int len, unsigned int flags,
}
#endif
}
normalize_ip6_compat(myaddr);
/* If the address is not a valid local address,
* then bind to any address...
*/
@ -268,7 +271,6 @@ myrecvfrom(int s, void *buf, int len, unsigned int flags,
}
}
normalize_ip6_compat(myaddr);
normalize_ip6_compat(from);
return n;