]> granicus.if.org Git - strace/commitdiff
Enhance diagnostics of address truncation in sockname family syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Sat, 9 Jul 2016 21:52:51 +0000 (21:52 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Tue, 12 Jul 2016 07:40:31 +0000 (07:40 +0000)
* net.c (decode_sockname): Print both user and kernel address lengths
when the returned address is truncated.
* tests/sun_path.expected: Update expected output.

net.c
tests/sun_path.expected

diff --git a/net.c b/net.c
index 86d93fc23c0fd6c31fa6b2845a339ede3569607a..245cae9a9f03eb3da8805d22a42a6699f467fb5f 100644 (file)
--- a/net.c
+++ b/net.c
@@ -225,7 +225,10 @@ decode_sockname(struct tcb *tcp)
                tprintf(", [%d]", ulen);
        } else {
                decode_sockaddr(tcp, tcp->u_arg[1], ulen > rlen ? rlen : ulen);
-               tprintf(", [%d]", rlen);
+               if (ulen < rlen)
+                       tprintf(", [%d->%d]", ulen, rlen);
+               else
+                       tprintf(", [%d]", rlen);
        }
 
        return RVAL_DECODED;
index 44076862684d32557cb7f060f5b2bd1a78a39310..30a11c03dd686533d260406d6f92f50c4992efa0 100644 (file)
@@ -1,3 +1,3 @@
 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +bind\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"\}, 110\) += 0
-[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"\}, \[111\]\) += 0
+[1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +getsockname\(0, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"\}, \[110->111\]\) += 0
 [1-9][0-9]* +[0-9]+:[0-9]+:[0-9]+\.[0-9]+ +connect\(1, \{sa_family=AF_(LOCAL|UNIX|FILE), sun_path="123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678"\}, 110\) += 0