summaryrefslogtreecommitdiffstats
path: root/sys/compat/svr4/svr4_sockio.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2016-08-02 13:57:20 +0000
committerglebius <glebius@FreeBSD.org>2016-08-02 13:57:20 +0000
commite59dbf9d991a8bccc8d2fd6f12677745e9e7873e (patch)
tree2b7343a3b844eb21bfeb10ad6f8c3fcc9396d3c2 /sys/compat/svr4/svr4_sockio.c
parent07c6b204dbd0fadea2627964d53153e605e07a51 (diff)
downloadFreeBSD-src-e59dbf9d991a8bccc8d2fd6f12677745e9e7873e.zip
FreeBSD-src-e59dbf9d991a8bccc8d2fd6f12677745e9e7873e.tar.gz
Merge r303263:
Partially revert r257696/r257713, which have an issue with writing to user controlled address. Restore the old code that emulated OSIOCGIFCONF in if.c. Approved by: re (kib)
Diffstat (limited to 'sys/compat/svr4/svr4_sockio.c')
-rw-r--r--sys/compat/svr4/svr4_sockio.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/sys/compat/svr4/svr4_sockio.c b/sys/compat/svr4/svr4_sockio.c
index 6e10e3f..9b7f994 100644
--- a/sys/compat/svr4/svr4_sockio.c
+++ b/sys/compat/svr4/svr4_sockio.c
@@ -73,6 +73,8 @@ bsd_to_svr4_flags(bf)
return sf;
}
+#define OSIOCGIFCONF _IOWR('i', 20, struct ifconf)
+
int
svr4_sock_ioctl(fp, td, retval, fd, cmd, data)
struct file *fp;
@@ -144,7 +146,6 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd, data)
case SVR4_SIOCGIFCONF:
{
struct svr4_ifconf sc;
- struct ifconf *ifc;
if ((error = copyin(data, &sc, sizeof(sc))) != 0)
return error;
@@ -153,19 +154,9 @@ svr4_sock_ioctl(fp, td, retval, fd, cmd, data)
sizeof(struct ifreq), sizeof(struct svr4_ifreq),
sc.svr4_ifc_len));
- ifc = (struct ifconf *)&sc;
- ifc->ifc_req->ifr_addr.sa_family =
- sc.svr4_ifc_req->svr4_ifr_addr.sa_family;
- ifc->ifc_req->ifr_addr.sa_len =
- sizeof(struct osockaddr);
-
- error = fo_ioctl(fp, SIOCGIFCONF, &sc, td->td_ucred,
- td);
-
- sc.svr4_ifc_req->svr4_ifr_addr.sa_family =
- ifc->ifc_req->ifr_addr.sa_family;
-
- if (error != 0)
+ if ((error = fo_ioctl(fp, OSIOCGIFCONF,
+ (caddr_t) &sc, td->td_ucred,
+ td)) != 0)
return error;
DPRINTF(("SIOCGIFCONF\n"));
OpenPOWER on IntegriCloud