[PATCH 7/8] io: Handle data_size of -1 as unlimited data in print_iovec

Eugene Syromyatnikov evgsyr at gmail.com
Thu Sep 29 12:57:55 UTC 2016


Otherwise it can be depleted and print_iovec starts printing empty
strings.

* io.c (print_iovec): Interpret c->data_size of -1 as unlimited data and
  do not decrease it in this case.
---
 io.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/io.c b/io.c
index 907f9d2..eb17524 100644
--- a/io.c
+++ b/io.c
@@ -85,13 +85,15 @@ print_iovec(struct tcb *tcp, void *elem_buf, size_t elem_size, void *data)
 		case IOV_DECODE_STR:
 			if (len > c->data_size)
 				len = c->data_size;
-			c->data_size -= len;
+			if (c->data_size != (unsigned long)-1L)
+				c->data_size -= len;
 			printstr(tcp, iov[0], len);
 			break;
 		case IOV_DECODE_NETLINK:
 			if (len > c->data_size)
 				len = c->data_size;
-			c->data_size -= len;
+			if (c->data_size != (unsigned long)-1L)
+				c->data_size -= len;
 			decode_netlink(tcp, iov[0], iov[1]);
 			break;
 		default:
-- 
1.7.10.4





More information about the Strace-devel mailing list