Fix accept(2) decoding

Andreas Schwab schwab at suse.de
Thu Jan 1 16:30:39 UTC 2009


The third argument of accept is a pointer to int, not long.  This also
fixes the decoding of getsockname and getpeername, which is implemented
in terms of this function.

Andreas.

2009-01-01  Andreas Schwab  <schwab at suse.de>

	* net.c (sys_accept): Properly decode third argument as pointer to
	int.

--- net.c	11 Nov 2008 10:12:17 +0100	1.58
+++ net.c	01 Jan 2009 17:18:43 +0100	
@@ -1315,13 +1315,15 @@ struct tcb *tcp;
 	} else if (!tcp->u_arg[2])
 		tprintf("%#lx, NULL", tcp->u_arg[1]);
 	else {
-		if (tcp->u_arg[1] == 0 || syserror(tcp)) {
+		int len;
+		if (tcp->u_arg[1] == 0 || syserror(tcp)
+		    || umove (tcp, tcp->u_arg[2], &len) < 0) {
 			tprintf("%#lx", tcp->u_arg[1]);
 		} else {
-			printsock(tcp, tcp->u_arg[1], tcp->u_arg[2]);
+			printsock(tcp, tcp->u_arg[1], len);
 		}
 		tprintf(", ");
-		printnum(tcp, tcp->u_arg[2], "%lu");
+		printnum_int(tcp, tcp->u_arg[2], "%u");
 	}
 	return 0;
 }

-- 
Andreas Schwab, SuSE Labs, schwab at suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




More information about the Strace-devel mailing list