Fix incorrect length passed to accept noted by Larry Doolittle.
authorMatt Kraai <kraai@debian.org>
Tue, 15 May 2001 03:05:39 +0000 (03:05 -0000)
committerMatt Kraai <kraai@debian.org>
Tue, 15 May 2001 03:05:39 +0000 (03:05 -0000)
nc.c
networking/nc.c

diff --git a/nc.c b/nc.c
index 72439dd..b58bd6a 100644 (file)
--- a/nc.c
+++ b/nc.c
@@ -80,10 +80,12 @@ int nc_main(int argc, char **argv)
        }
 
        if (do_listen) {
+               socklen_t addrlen = sizeof(address);
+
                if (listen(sfd, 1) < 0)
                        perror_msg_and_die("listen");
 
-               if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &opt)) < 0)
+               if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &addrlen)) < 0)
                        perror_msg_and_die("accept");
 
                close(sfd);
index 72439dd..b58bd6a 100644 (file)
@@ -80,10 +80,12 @@ int nc_main(int argc, char **argv)
        }
 
        if (do_listen) {
+               socklen_t addrlen = sizeof(address);
+
                if (listen(sfd, 1) < 0)
                        perror_msg_and_die("listen");
 
-               if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &opt)) < 0)
+               if ((tmpfd = accept(sfd, (struct sockaddr *) &address, &addrlen)) < 0)
                        perror_msg_and_die("accept");
 
                close(sfd);