1
0
mirror of https://git.libssh.org/projects/libssh.git synced 2025-08-08 19:02:06 +03:00

packet: Abort session on fatal errors on packets

This commit is contained in:
Aris Adamantiadis
2011-06-09 23:27:41 +02:00
parent 640e3830f2
commit 7ff69d9c48

View File

@@ -136,7 +136,8 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
size_t processed=0; /* number of byte processed from the callback */ size_t processed=0; /* number of byte processed from the callback */
enter_function(); enter_function();
if (session->session_state == SSH_SESSION_STATE_ERROR)
goto error;
switch(session->packet_state) { switch(session->packet_state) {
case PACKET_STATE_INIT: case PACKET_STATE_INIT:
if(receivedlen < blocksize){ if(receivedlen < blocksize){
@@ -289,6 +290,7 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
session->packet_state); session->packet_state);
error: error:
session->session_state= SSH_SESSION_STATE_ERROR;
leave_function(); leave_function();
return processed; return processed;
} }