[Patch] rexec check for sockaddr length
Thorsten Kukuk
kukuk@suse.de
Sun Apr 8 22:07:00 GMT 2001
On Sun, Apr 08, Ulrich Drepper wrote:
> Thorsten Kukuk <kukuk@suse.de> writes:
>
> > --- inet/rexec.c 2000/10/28 00:28:37 1.17
> > +++ inet/rexec.c 2001/04/07 14:47:40
> > @@ -117,8 +117,7 @@
> > }
> > listen(s2, 1);
> > sa2len = sizeof (sa2);
> > - if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0 ||
> > - sa2len != SA_LEN((struct sockaddr *)&sa2)) {
> > + if (getsockname(s2, (struct sockaddr *)&sa2, &sa2len) < 0) {
> > perror("getsockname");
> > (void) __close(s2);
>
> The only problem which exists here is that errno is not set if "only"
> the size differs. The size test itself is correct, it was there in
> some form or another forever. I've checked in a patch for that.
That there was a check for ever means nothing. It is not necessary
(or getsockname will fail) and prevents glibc from working in cases
where it works without problems.
And I don't think that the new return value is correct. I don't see
where there should be a invalid argument ?
Thorsten
--
Thorsten Kukuk http://www.suse.de/~kukuk/ kukuk@suse.de
SuSE GmbH Schanzaeckerstr. 10 90443 Nuernberg
Linux is like a Vorlon. It is incredibly powerful, gives terse,
cryptic answers and has a lot of things going on in the background.
More information about the Libc-hacker
mailing list