Fix null pointer dereference 23/29523/1
authorVitalii Irkha <v.irkha@samsung.com>
Fri, 24 May 2019 09:23:11 +0000 (12:23 +0300)
committerVitalii Irkha <v.irkha@samsung.com>
Fri, 24 May 2019 09:23:11 +0000 (12:23 +0300)
Added input data check for verifyIdentity() API

Change-Id: Ic4fca882dacf5f9d5eccfde9e94c16ee7fe74df5
Signed-off-by: Vitalii Irkha <v.irkha@samsung.com>
resource/csdk/connectivity/src/adapter_util/ca_adapter_net_ssl.c

index 987f66d..a900fda 100644 (file)
@@ -1359,6 +1359,12 @@ static int verifyIdentity( void *data, mbedtls_x509_crt *crt, int depth, uint32_
     {
         return MBEDTLS_ERR_X509_FEATURE_UNAVAILABLE;
     }
+
+    if (NULL == crt || NULL == crt->raw.p)
+    {
+        return MBEDTLS_ERR_X509_BAD_INPUT_DATA;
+    }
+
     g_getIdentityCallback(&ctx, crt->raw.p, crt->raw.len);
     if (0 == depth) // leaf certificate
     {