Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Dec 1997 18:34:20 +0100 (CET)
From:      Pierre Beyssac <pb@fasterix.freenix.org>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/5291: oaccept() not correctly returning peer address
Message-ID:  <199712141734.SAA00682@fasterix.frmug.org>
Resent-Message-ID: <199712141750.JAA22511@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         5291
>Category:       kern
>Synopsis:       oaccept() not correctly returning peer address
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 14 09:50:01 PST 1997
>Last-Modified:
>Originator:     Pierre Beyssac
>Organization:
individual
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

3.0-current kernel compiled with COMPAT_43. Linux emulator.

>Description:

oaccept() doesn't correctly return the peer sockaddr.
This is the same as the previous problem with recvfrom().

>How-To-Repeat:

Use any Linux program which does an accept() and displays the peer
address. I used "nc -l -vv -p 1200", then telnet localhost 1200.

>Fix:
	
--- uipc_syscalls.c.orig	Sun Dec 14 15:05:04 1997
+++ uipc_syscalls.c	Sun Dec 14 18:28:44 1997
@@ -242,15 +242,16 @@
 			goto gotnoname;
 		return 0;
 	}
 	if (uap->name) {
+		/* check sa_len before it is destroyed */
+		if (namelen > sa->sa_len)
+			namelen = sa->sa_len;
 #ifdef COMPAT_OLDSOCK
 		if (compat)
 			((struct osockaddr *)sa)->sa_family =
 			    sa->sa_family;
 #endif
-		if (namelen > sa->sa_len)
-			namelen = sa->sa_len;
 		error = copyout(sa, (caddr_t)uap->name, (u_int)namelen);
 		if (!error)
 gotnoname:
 			error = copyout((caddr_t)&namelen,
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199712141734.SAA00682>