aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-06-23 15:35:43 -0400
committerNick Mathewson <nickm@torproject.org>2012-06-23 15:35:43 -0400
commitffd7189b3fc015ce47e6ab27ac85d4eab2183a2b (patch)
tree1cb0830b664d2e7ef94ad7ec346524f046e435a6 /src
parentb1ad1a1d0266a20bb0dac15e65abe7b65a74e8a0 (diff)
downloadtor-ffd7189b3fc015ce47e6ab27ac85d4eab2183a2b.tar
tor-ffd7189b3fc015ce47e6ab27ac85d4eab2183a2b.tar.gz
Don't assert in get_string_from_pipe() on len==0
We can treat this case as an EAGAIN (probably because of an unexpected internal NUL) rather than a crash-worthy problem. Fixes bug 6225, again. Bug not in any released version of Tor.
Diffstat (limited to 'src')
-rw-r--r--src/common/util.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/common/util.c b/src/common/util.c
index 8cb013e18..e5b51b9a9 100644
--- a/src/common/util.c
+++ b/src/common/util.c
@@ -4386,7 +4386,10 @@ get_string_from_pipe(FILE *stream, char *buf_out, size_t count)
}
} else {
len = strlen(buf_out);
- tor_assert(len>0);
+ if (len == 0) {
+ /* this probably means we got a NUL at the start of the string. */
+ return IO_STREAM_EAGAIN;
+ }
if (buf_out[len - 1] == '\n') {
/* Remove the trailing newline */