From b21e13f7488cedf597451fa2e9edcd078f118ef7 Mon Sep 17 00:00:00 2001 From: ftao Date: Sat, 12 Apr 2014 00:46:12 +0800 Subject: [PATCH] fix ss_decrypt_all failed ,cause server crash --- src/udprelay.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/udprelay.c b/src/udprelay.c index 9c7d5f20..2b497892 100644 --- a/src/udprelay.c +++ b/src/udprelay.c @@ -504,6 +504,13 @@ static void remote_recv_cb (EV_P_ ev_io *w, int revents) #ifdef UDPRELAY_LOCAL buf = ss_decrypt_all(BUF_SIZE, buf, &buf_len, server_ctx->method); + if (buf == NULL){ + if (verbose) + { + ERROR("udprelay_server_ss_decrypt_all"); + } + goto CLEAN_UP; + } int len = parse_udprealy_header(buf, buf_len, NULL, NULL); if (len == 0 || len != addr_header_len) @@ -580,6 +587,13 @@ static void server_recv_cb (EV_P_ ev_io *w, int revents) #ifdef UDPRELAY_REMOTE buf = ss_decrypt_all(BUF_SIZE, buf, &buf_len, server_ctx->method); + if (buf == NULL){ + if (verbose) + { + ERROR("udprelay_server_ss_decrypt_all"); + } + goto CLEAN_UP; + } #endif #ifdef UDPRELAY_LOCAL