Date: Wed, 28 Aug 2002 12:05:40 -0700 (PDT) From: Randy Zach <zach@zach.com> To: freebsd-gnats-submit@FreeBSD.org Subject: misc/42135: Truss dumps core printing socket address Message-ID: <200208281905.g7SJ5eua080662@www.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 42135
>Category: misc
>Synopsis: Truss dumps core printing socket address
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Wed Aug 28 12:10:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: Randy Zach
>Release: 4.6.2
>Organization:
Randy Zach Consulting
>Environment:
FreeBSD freeb.zach.com 4.6.2-RELEASE FreeBSD 4.6.2-RELEASE #0: Wed Aug 21 00:38:50 PDT 2002 zach@freeb.zach.com:/usr/obj/usr/src/sys/RZ i386
>Description:
The pretty print code for Sockaddrs copies the target's socket structure using the target's socket len, regardless of whether or not it will fit in the sockaddr_storage struct.
>How-To-Repeat:
The following debug target will exercise the problem:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
main()
{
struct sockaddr_in addr;
addr.sin_len = 250;
addr.sin_family = AF_INET;
addr.sin_port = htons(1234);
addr.sin_addr.s_addr = 0x12345678;
connect(123, (struct sockaddr *)&addr, 16);
}
truss ./a.out will terminate with truss dumping core.
>Fix:
In /usr/src/usr.bin/truss/syscalls.c
*** syscalls.c Wed Aug 28 11:27:00 2002
--- syscalls.c.orig Wed Aug 28 11:39:12 2002
***************
*** 308,315 ****
== -1)
err(2, "get_struct %p", (void *)args[sc->offset]);
} else {
! if (get_struct(fd, (void *)args[sc->offset], (void *)&ss,
! ss.ss_len < sizeof(ss) ? ss.ss_len : sizeof(ss))
== -1)
err(2, "get_struct %p", (void *)args[sc->offset]);
}
--- 308,314 ----
== -1)
err(2, "get_struct %p", (void *)args[sc->offset]);
} else {
! if (get_struct(fd, (void *)args[sc->offset], (void *)&ss, ss.ss_len)
== -1)
err(2, "get_struct %p", (void *)args[sc->offset]);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208281905.g7SJ5eua080662>
