aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAris Adamantiadis <aris@0xbadc0de.be>2014-01-07 14:43:01 +0100
committerAris Adamantiadis <aris@0xbadc0de.be>2014-01-07 14:43:01 +0100
commit1c36642feda8b6422dcf9e9651146bb55ff6ddd8 (patch)
treec58f92d0cca0b7db266f87deaa6a7f885a54d5a3
parentad287371fb65bac8228598cddad355cdd71a004f (diff)
downloadlibssh-1c36642feda8b6422dcf9e9651146bb55ff6ddd8.tar.gz
libssh-1c36642feda8b6422dcf9e9651146bb55ff6ddd8.tar.xz
libssh-1c36642feda8b6422dcf9e9651146bb55ff6ddd8.zip
tests: avoid reading uninitialized bytes
-rw-r--r--tests/client/torture_request_env.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/client/torture_request_env.c b/tests/client/torture_request_env.c
index e4368664..7c7338ed 100644
--- a/tests/client/torture_request_env.c
+++ b/tests/client/torture_request_env.c
@@ -78,13 +78,13 @@ static void torture_request_env(void **state)
rc = ssh_channel_request_exec(c, "bash -c export");
assert_int_equal(rc, SSH_OK);
- nbytes = ssh_channel_read(c, buffer, sizeof(buffer), 0);
+ nbytes = ssh_channel_read(c, buffer, sizeof(buffer) - 1, 0);
while (nbytes > 0) {
#if 0
rc = fwrite(buffer, 1, nbytes, stdout);
assert_int_equal(rc, nbytes);
#endif
-
+ buffer[nbytes]='\0';
if (strstr(buffer, "LC_LIBSSH=\"LIBSSH\"")) {
lang_found = 1;
break;