summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-08-29 00:36:41 +0100
committerSteven Murdoch <Steven.Murdoch@cl.cam.ac.uk>2011-08-29 00:36:41 +0100
commit93792b5aa6806646674795504419f3e97862685c (patch)
tree58b3fd7056856cd15776dc5e345a7e52c2f41f88
parentf1ff65dfad800ed89e5b01c1c5b4b77c10a438b8 (diff)
downloadtor-93792b5aa6806646674795504419f3e97862685c.tar.gz
tor-93792b5aa6806646674795504419f3e97862685c.zip
Add a sanity check
-rw-r--r--src/common/util.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 371e09b8db..dd2d1110e9 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -3462,10 +3462,11 @@ tor_read_all_handle(HANDLE h, char *buf, size_t count, HANDLE hProcess)
continue;
}
+ /* There is data to read; read it */
retval = ReadFile(h, buf+numread, count-numread, &byte_count, NULL);
+ tor_assert(byte_count + numread <= count);
if (!retval) {
- log_warn(LD_GENERAL,
- "Failed to read from handle: %s",
+ log_warn(LD_GENERAL, "Failed to read from handle: %s",
format_win32_error(GetLastError()));
return -1;
} else if (0 == byte_count) {