- Fix a crash on a rpc entry when an IPv6 address is explicitly specified

in -a flag.

- Fix a bug that sockaddr_in was used where sockaddr_in6 should have
  been used.  This was not actually harmful because offsetof(struct
  sockaddr_in, sin_port) is equal to offsetof(struct sockaddr_in6,
  sin6_port).

MFC after:	1 day
This commit is contained in:
hrs 2015-09-19 23:27:22 +00:00
parent b76aba5008
commit 640e18a8e1

View File

@ -1752,8 +1752,6 @@ getconfigent(void)
memmove(sep->se_proto, sep->se_proto + 4,
strlen(sep->se_proto) + 1 - 4);
sep->se_rpc = 1;
memcpy(&sep->se_ctrladdr4, bind_sa4,
sizeof(sep->se_ctrladdr4));
sep->se_rpc_prog = sep->se_rpc_lowvers =
sep->se_rpc_highvers = 0;
if ((versp = strrchr(sep->se_service, '/'))) {
@ -2130,8 +2128,8 @@ check_loop(const struct sockaddr *sa, const struct servtab *sep)
continue;
#ifdef INET6
case AF_INET6:
if (((const struct sockaddr_in *)sa)->sin_port ==
se2->se_ctrladdr4.sin_port)
if (((const struct sockaddr_in6 *)sa)->sin6_port ==
se2->se_ctrladdr6.sin6_port)
goto isloop;
continue;
#endif