#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.
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
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.
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.
Created attachment 717 [details] Updated patch, not tested yet
Created attachment 718 [details] Grrmbl, sorry, here is the real corrected patch. Not tested either
That last patch does work as expected.
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
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
Thanks for the braino fix. It's in on both branches. Please verify that everything is good.
Seems good, thanks!