From 7e1274077cb893c3c1aa43bdf18876bab5bcbc56 Mon Sep 17 00:00:00 2001 From: Vitalii Irkha Date: Thu, 22 Aug 2019 16:20:34 +0300 Subject: [PATCH] CONPRO-1481 crash while fuzzing with nmap Check dataLen before read data from TLS connection https://github.sec.samsung.net/RS7-IOTIVITY/IoTivity/commit/7cc9764f1b6698759f76bbfa35d9d497e22b13f9 (cherry-picked from 7cc9764f1b6698759f76bbfa35d9d497e22b13f9) Change-Id: I33e010519573155725e5f1986b60bdcacfa3db2b Signed-off-by: Vitalii Irkha Signed-off-by: Sudipto --- resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c index 355b0aa..966b2a4 100644 --- a/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c +++ b/resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c @@ -2479,6 +2479,12 @@ CAResult_t CAdecryptSsl(const CASecureEndpoint_t *sep, uint8_t *data, uint32_t d VERIFY_NON_NULL_RET(sep, NET_SSL_TAG, "endpoint is NULL" , CA_STATUS_INVALID_PARAM); VERIFY_NON_NULL_RET(data, NET_SSL_TAG, "Param data is NULL" , CA_STATUS_INVALID_PARAM); + if (0 == dataLen) + { + OIC_LOG(ERROR, NET_SSL_TAG, "dataLen is zero"); + return CA_STATUS_FAILED; + } + oc_mutex_lock(g_sslContextMutex); if (NULL == g_caSslContext) { -- 2.7.4