[PATCH] Two obvious desc.c fixes

Dmitry V. Levin ldv at altlinux.org
Wed Apr 7 00:16:52 UTC 2010


I'm about to push the following fixes:

From 6e6337549506469fd6dc3e20e7623f3161b476f6 Mon Sep 17 00:00:00 2001
From: Dmitry V. Levin <ldv at altlinux.org>
Date: Tue, 6 Apr 2010 23:50:49 +0000
Subject: [PATCH 1/2] * desc.c (decode_select): Fix potential stack buffer overflow.

---
 desc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/desc.c b/desc.c
index 383107e..c615663 100644
--- a/desc.c
+++ b/desc.c
@@ -546,7 +546,6 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
 		outstr[0] = '\0';
 		for (i = 0; i < 3; i++) {
 			int first = 1;
-			char str[20];
 
 			tcp->auxstr = outstr;
 			arg = args[i+1];
@@ -555,6 +554,8 @@ decode_select(struct tcb *tcp, long *args, enum bitness_t bitness)
 				continue;
 			for (j = 0; j < args[0]; j++) {
 				if (FD_ISSET(j, fds)) {
+					char str[11 + 3 * sizeof(int)];
+
 					if (first) {
 						sprintf(str, "%s%s [%u", sep,
 							i == 0 ? "in" :

From 9676499f89dbb6e870ed19c857c4ceaca44452b7 Mon Sep 17 00:00:00 2001
From: Dmitry V. Levin <ldv at altlinux.org>
Date: Tue, 6 Apr 2010 23:54:18 +0000
Subject: [PATCH 2/2] * desc.c (sys_epoll_pwait): Fix output formatting bug.

---
 desc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/desc.c b/desc.c
index c615663..9571e49 100644
--- a/desc.c
+++ b/desc.c
@@ -772,8 +772,10 @@ int
 sys_epoll_pwait(struct tcb *tcp)
 {
 	epoll_wait_common(tcp);
-	if (exiting(tcp))
+	if (exiting(tcp)) {
+		tprintf(", ");
 		print_sigset(tcp, tcp->u_arg[4], 0);
+	}
 	return 0;
 }
 
-- 
ldv
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.strace.io/pipermail/strace-devel/attachments/20100407/f8dd86eb/attachment.bin>


More information about the Strace-devel mailing list