From 363eb8e27befc10dcff85aaadcbbf5d651c2394e Mon Sep 17 00:00:00 2001
From: Craig Tiller <ctiller@google.com>
Date: Wed, 25 Feb 2015 09:50:46 -0800
Subject: [PATCH] Fix read through null pointer

---
 src/core/tsi/ssl_transport_security.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/tsi/ssl_transport_security.c b/src/core/tsi/ssl_transport_security.c
index 9ca8e6ddc9..8446cc4fdc 100644
--- a/src/core/tsi/ssl_transport_security.c
+++ b/src/core/tsi/ssl_transport_security.c
@@ -1094,8 +1094,9 @@ static int does_entry_match_name(const char* entry, size_t entry_length,
     return 0;
   }
   name_subdomain = strchr(name, '.');
+  if (name_subdomain == NULL) return 0;
   name_subdomain_length = strlen(name_subdomain);
-  if (name_subdomain == NULL || name_subdomain_length < 2) return 0;
+  if (name_subdomain_length < 2) return 0;
   name_subdomain++; /* Starts after the dot. */
   name_subdomain_length--;
   entry += 2;       /* Remove *. */
-- 
GitLab