Print this page
4142 truss should expand connect() arguments

@@ -3483,16 +3483,16 @@
 {
         /*
          * A buffer large enough for PATH_MAX size AF_UNIX address, which is
          * also large enough to store a sockaddr_in or a sockaddr_in6.
          */
-        long buf[(sizeof (short) + PATH_MAX + sizeof (long) - 1)
-            / sizeof (long)];
-        struct sockaddr *sa = (struct sockaddr *)buf;
-        struct sockaddr_in *sin = (struct sockaddr_in *)buf;
-        struct sockaddr_un *soun = (struct sockaddr_un *)buf;
-        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)buf;
+        struct sockaddr_storage buf;
+
+        struct sockaddr *sa = (struct sockaddr *)&buf;
+        struct sockaddr_in *sin = (struct sockaddr_in *)&buf;
+        struct sockaddr_un *soun = (struct sockaddr_un *)&buf;
+        struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)&buf;
         char addrbuf[INET6_ADDRSTRLEN];
 
         if (lenoff != 0) {
                 uint_t ilen;
                 if (Pread(Proc, &ilen, sizeof (ilen), lenoff) != sizeof (ilen))

@@ -3500,11 +3500,11 @@
                 len = ilen;
         }
 
         if (len >= sizeof (buf))        /* protect against ridiculous length */
                 len = sizeof (buf) - 1;
-        if (Pread(Proc, buf, len, addroff) != len)
+        if (Pread(Proc, (void*)&buf, len, addroff) != len)
                 return;
 
         switch (sa->sa_family) {
         case AF_INET6:
                 (void) printf("%s\tAF_INET6  %s = %s  port = %u\n",