Verified Commit dd7d70b4 authored by Grigorii Demidov's avatar Grigorii Demidov Committed by Vladimír Čunát

daemon/io: fix insufficient error handling when receiving tls data

parent 20e8fe26
Pipeline #42667 failed with stages
in 44 minutes and 13 seconds
......@@ -222,6 +222,9 @@ static void tcp_recv(uv_stream_t *handle, ssize_t nread, const uv_buf_t *buf)
/* buf->base points to start of the tls receive buffer.
Decode data free space in session wire buffer. */
consumed = tls_process_input_data(s, (const uint8_t *)buf->base, nread);
if (consumed <= 0) {
return;
}
data = session_wirebuf_get_free_start(s);
data_len = consumed;
}
......
......@@ -496,6 +496,11 @@ ssize_t session_wirebuf_consume(struct session *session, const uint8_t *data, ss
return kr_error(EINVAL);
}
if (len < 0) {
/* shouldn't happen */
return kr_error(EINVAL);
}
if (session->wire_buf_end_idx + len > session->wire_buf_size) {
/* shouldn't happen */
return kr_error(EINVAL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment