Package: netcat-openbsd Version: 1.89-4 Tags: patch Without this patch, nc.openbsd (a) uses a structure which may be too small (struct sockaddr_storage is not, AIUI, guaranteed to be large enough for a struct sockaddr_un), and (b) treats the sockaddr_un result from accept as if it were an sockaddr_in and crashes.
With this patch, the AF_UNIX case works. I have switched on the command-line flag since that is how the rest of the code works, although really it ought to be done by looking at sa_family. Observed behaviour: $ rm spong; nc.openbsd -U -l -v spong [sits waiting for connection] [in another window:] $ nc.openbsd -U spong Segmentation fault $ $ Desired behaviour: $ rm spong; nc.openbsd -U -l -v spong [sits waiting for connection] [in another window:] $ nc.openbsd -U spong Connection from "" accepted [sits waiting for input] [sits waiting for input] Ian. commit f7c05ae9c485eba4d353038502a51ccb8ad65234 Author: Ian Jackson <i...@liberator.relativity.greenend.org.uk> Date: Tue Apr 27 23:04:35 2010 +0100 Do not crash on -U -l -v diff --git a/netcat.c b/netcat.c index c5def68..678e557 100644 --- a/netcat.c +++ b/netcat.c @@ -126,7 +126,10 @@ main(int argc, char *argv[]) struct addrinfo hints; struct servent *sv; socklen_t len; - struct sockaddr_storage cliaddr; + union { + struct sockaddr_storage storage; + struct sockaddr_un forunix; + } cliaddr; char *proxy = NULL; const char *proxyhost = "", *proxyport = NULL; struct addrinfo proxyhints; @@ -347,7 +350,11 @@ main(int argc, char *argv[]) &len); } - if(vflag) { + if(vflag && family == AF_UNIX) { + fprintf(stderr, "Connection from \"%.*s\" accepted\n", + len - (int)offsetof(struct sockaddr_un, sun_path), + ((struct sockaddr_un*)&cliaddr)->sun_path); + } else if(vflag) { /* Don't look up port if -n. */ if (nflag) sv = NULL; -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org