2007-01-12 Dmitry V. Levin <ldv@altlinux.org>

* sock.c (sock_ioctl): Check umove() return code.
This commit is contained in:
Дмитрий Левин 2007-03-21 14:18:17 +00:00
parent ecdd0bbb52
commit 652e448783
2 changed files with 11 additions and 7 deletions

View File

@ -1,7 +1,7 @@
2007-01-12 Dmitry V. Levin <ldv@altlinux.org>
* sock.c (sock_ioctl) [LINUX]: Handle SIOCGIFTXQLEN and
SIOCGIFMAP.
* sock.c (sock_ioctl): Check umove() return code.
[LINUX] Handle SIOCGIFTXQLEN and SIOCGIFMAP.
2007-03-16 Roland McGrath <roland@redhat.com>

14
sock.c
View File

@ -93,8 +93,8 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
if (entering(tcp)) {
if (code == SIOCGIFCONF) {
umove(tcp, tcp->u_arg[2], &ifc);
if (ifc.ifc_buf == NULL)
if (umove(tcp, tcp->u_arg[2], &ifc) >= 0
&& ifc.ifc_buf == NULL)
tprintf(", {%d -> ", ifc.ifc_len);
else
tprintf(", {");
@ -146,8 +146,9 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
case SIOCGIFHWADDR:
case SIOCGIFTXQLEN:
case SIOCGIFMAP:
umove(tcp, tcp->u_arg[2], &ifr);
if (syserror(tcp)) {
if (umove(tcp, tcp->u_arg[2], &ifr) < 0)
tprintf(", %#lx", tcp->u_arg[2]);
else if (syserror(tcp)) {
if (code == SIOCGIFNAME)
tprintf(", {ifr_index=%d, ifr_name=???}", ifr.ifr_ifindex);
else
@ -223,7 +224,10 @@ sock_ioctl(struct tcb *tcp, long code, long arg)
}
return 1;
case SIOCGIFCONF:
umove(tcp, tcp->u_arg[2], &ifc);
if (umove(tcp, tcp->u_arg[2], &ifc) < 0) {
tprintf("???}");
return 1;
}
tprintf("%d, ", ifc.ifc_len);
if (syserror(tcp)) {
tprintf("%lx", (unsigned long) ifc.ifc_buf);