mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-06-11 12:56:21 +09:00
torture_packet: Improve checking of ssh_packet_socket_callback() return value
ssh_packet_socket_callback() will not return error codes like SSH_ERROR on failure. Instead it will always return an unsigned size_t value representing the number of bytes which have been processed. So adjust the assert in the test accordingly, making sure that all input bytes have actually been processed. Signed-off-by: Colin Baumgarten <colin.baumgarten@hubersuhner.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com> Merge-Request: <https://gitlab.com/libssh/libssh-mirror/-/merge_requests/824>
This commit is contained in:
committed by
Jakub Jelen
parent
655601d357
commit
a33da974ef
@@ -57,6 +57,7 @@ torture_packet(const char *cipher, const char *mac_type,
|
||||
uint8_t buffer[1024];
|
||||
uint8_t response[1024];
|
||||
size_t encrypted_packet_len;
|
||||
size_t processed;
|
||||
ssh_packet_callback callbacks[]={copy_packet_data};
|
||||
struct ssh_packet_callbacks_struct cb = {
|
||||
.start=2,
|
||||
@@ -132,8 +133,9 @@ torture_packet(const char *cipher, const char *mac_type,
|
||||
|
||||
ssh_packet_set_callbacks(session, &cb);
|
||||
ssh_burn(response, sizeof(response));
|
||||
rc = ssh_packet_socket_callback(buffer, encrypted_packet_len, session);
|
||||
assert_int_not_equal(rc, SSH_ERROR);
|
||||
processed =
|
||||
ssh_packet_socket_callback(buffer, encrypted_packet_len, session);
|
||||
assert_int_equal(processed, encrypted_packet_len);
|
||||
if(payload_len > 0){
|
||||
assert_memory_equal(response, test_data+1, payload_len-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user