CONPRO-1481 crash while fuzzing with nmap 18/212718/1
authorVitalii Irkha <v.irkha@samsung.com>
Thu, 22 Aug 2019 13:20:34 +0000 (16:20 +0300)
committerSudipto <sudipto.bal@samsung.com>
Mon, 26 Aug 2019 08:03:36 +0000 (13:33 +0530)
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 <v.irkha@samsung.com>
Signed-off-by: Sudipto <sudipto.bal@samsung.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index 355b0aad3edfdaa0122be0cfbca45a5d68bf63e4..966b2a4007fcab251024d05dc698ee78b7c89600 100644 (file)
@@ -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)
     {