mirror of
https://git.libssh.org/projects/libssh.git
synced 2025-07-31 00:03:07 +03:00
tests: avoid reading uninitialized bytes
This commit is contained in:
@ -78,13 +78,13 @@ static void torture_request_env(void **state)
|
|||||||
rc = ssh_channel_request_exec(c, "bash -c export");
|
rc = ssh_channel_request_exec(c, "bash -c export");
|
||||||
assert_int_equal(rc, SSH_OK);
|
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) {
|
while (nbytes > 0) {
|
||||||
#if 0
|
#if 0
|
||||||
rc = fwrite(buffer, 1, nbytes, stdout);
|
rc = fwrite(buffer, 1, nbytes, stdout);
|
||||||
assert_int_equal(rc, nbytes);
|
assert_int_equal(rc, nbytes);
|
||||||
#endif
|
#endif
|
||||||
|
buffer[nbytes]='\0';
|
||||||
if (strstr(buffer, "LC_LIBSSH=\"LIBSSH\"")) {
|
if (strstr(buffer, "LC_LIBSSH=\"LIBSSH\"")) {
|
||||||
lang_found = 1;
|
lang_found = 1;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user