This is sources Bugzilla
Bugzilla Version 2.17.5
Bugzilla Bug 1254
  getpeername(fd,NULL,&len) crashes even if len==0 Last modified: 2005-10-23 19:15:10
     Query page      Enter new bug
Bug#: 1254   Hardware:   Reporter: Thomas Schwinge <tschwinge@gnu.org>
Host: Target: Build:
Product:     Add CC:
Component:   Version:   CC:
Remove selected CCs
Status: RESOLVED   Priority:  
Resolution: FIXED   Severity:  
Assigned To: Roland McGrath <roland@gnu.org>   Target Milestone:  
Flags: Requestee:
  backport ()
  examined ()
  testsuite ()
Summary:
Keywords:

Attachment Description Type Created Actions
getpeername.c.diff Updated patch, not tested yet patch 2005-10-17 22:59 Edit | Diff
getpeername.c.diff Grrmbl, sorry, here is the real corrected patch. Not tested either patch 2005-10-17 23:00 Edit | Diff
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 1254 depends on: Show dependency tree
Show dependency graph
Bug 1254 blocks: 852

Additional Comments:


Leave as RESOLVED FIXED
Reopen bug
Mark bug as VERIFIED

View Bug Activity   |   Format For Printing


Description:   Last confirmed: 0000-00-00 00:00 Opened: 2005-08-26 23:08
#v+
2005-08-11  Samuel Thibault <samuel.thibault@ens-lyon.org>

	* sysdeps/mach/hurd/getpeername.c (__getpeername): Check length
	of buffer before writing the sa_family member.
#v-

http://sources.redhat.com/ml/libc-alpha/2005-08/msg00030.html

Needs to be fixed on HEAD and glibc-2_3-branch.

------- Additional Comment #1 From cvs-commit@gcc.gnu.org 2005-10-16 10:09 -------
Subject: Bug 1254

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	roland@sources.redhat.com	2005-10-16 10:09:30

Modified files:
	sysdeps/mach/hurd: getpeername.c 

Log message:
	2005-10-16  Roland McGrath  <roland@frob.com>
	
	[BZ #1254]
	* sysdeps/mach/hurd/getpeername.c (__getpeername): Respect *LEN
	byte limit when setting ADDR->sa_family.
	Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/mach/hurd/getpeername.c.diff?cvsroot=glibc&r1=1.11&r2=1.12


------- Additional Comment #2 From Roland McGrath 2005-10-16 10:10 -------
I checked in a different change.  Please verify that it works right and then
I'll put it on the 2.3 branch as well.

------- Additional Comment #3 From Samuel Thibault 2005-10-17 22:57 -------
Hi,  It doesn't work, because the af_family is not the first of the structure (there is af_len too), so that in getpeername(fd,NULL, 0), *len - offsetof(struct sockaddr, sa_family) becomes negative. 

------- Additional Comment #4 From Samuel Thibault 2005-10-17 22:59 -------
Created an attachment (id=717)
Updated patch, not tested yet

------- Additional Comment #5 From Samuel Thibault 2005-10-17 23:00 -------
Created an attachment (id=718)
Grrmbl, sorry, here is the real corrected patch. Not tested either

------- Additional Comment #6 From Samuel Thibault 2005-10-18 18:25 -------
That last patch does work as expected. 

------- Additional Comment #7 From cvs-commit@gcc.gnu.org 2005-10-23 00:46 -------
Subject: Bug 1254

CVSROOT:	/cvs/glibc
Module name:	libc
Changes by:	roland@sources.redhat.com	2005-10-23 00:46:36

Modified files:
	sysdeps/mach/hurd: getpeername.c 

Log message:
	2005-10-22  Roland McGrath  <roland@redhat.com>
	
	[BZ #1254]
	* sysdeps/mach/hurd/getpeername.c (__getpeername): Fix last change.
	From Samuel Thibault <samuel.thibault@ens-lyon.org>.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/mach/hurd/getpeername.c.diff?cvsroot=glibc&r1=1.12&r2=1.13


------- Additional Comment #8 From cvs-commit@gcc.gnu.org 2005-10-23 00:53 -------
Subject: Bug 1254

CVSROOT:	/cvs/glibc
Module name:	libc
Branch: 	glibc-2_3-branch
Changes by:	roland@sources.redhat.com	2005-10-23 00:53:24

Modified files:
	sysdeps/mach/hurd: getpeername.c 

Log message:
	2005-10-22  Roland McGrath  <roland@frob.com>
	
	[BZ #1254]
	* sysdeps/mach/hurd/getpeername.c (__getpeername): Fix last change.
	From Samuel Thibault <samuel.thibault@ens-lyon.org>.
	2005-10-16  Roland McGrath  <roland@frob.com>
	
	[BZ #1254]
	* sysdeps/mach/hurd/getpeername.c (__getpeername): Respect *LEN
	byte limit when setting ADDR->sa_family.
	Reported by Samuel Thibault <samuel.thibault@ens-lyon.org>.

Patches:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/libc/sysdeps/mach/hurd/getpeername.c.diff?cvsroot=glibc&only_with_tag=glibc-2_3-branch&r1=1.11&r2=1.11.6.1


------- Additional Comment #9 From Roland McGrath 2005-10-23 00:57 -------
Thanks for the braino fix.  It's in on both branches.
Please verify that everything is good.

------- Additional Comment #10 From Samuel Thibault 2005-10-23 19:15 -------
Seems good, thanks! 

     Query page      Enter new bug
Actions: New | Query | bug # | Reports | Requests   New Account | Log In