[PATCH] rexec's 2nd argument should be network order
Jakub Jelinek
jakub@redhat.com
Wed Oct 11 11:01:00 GMT 2000
Hi!
In glibc 2.1.x, the rport argument from rexec is passed directly into
sin_port (ie. it is network byte order), similarly Irix manpage for exec
suggest using getservbyname("exec","tcp")->s_port to be passed as second
argument to rexec.
But in current CVS we snprintf it into buffer and if I understand right
getaddrinfo later on does a strtoul on this, converts the result using
htons() and passes that into sin_port.
2000-10-11 Jakub Jelinek <jakub@redhat.com>
* inet/rexec.c (rexec_af): Convert rport to host order before
passing it to snprintf.
--- libc/inet/rexec.c.jj Wed May 31 23:02:40 2000
+++ libc/inet/rexec.c Wed Oct 11 19:55:12 2000
@@ -65,7 +65,7 @@ rexec_af(ahost, rport, name, pass, cmd,
int gai;
char servbuff[NI_MAXSERV];
- snprintf(servbuff, sizeof(servbuff), "%d", rport);
+ snprintf(servbuff, sizeof(servbuff), "%d", ntohs(rport));
servbuff[sizeof(servbuff) - 1] = '\0';
memset(&hints, 0, sizeof(hints));
Jakub
More information about the Libc-hacker
mailing list