More care with transport process results
[exim.git] / src / src / tlscert-gnu.c
index a09fda0b93f6abcbec2064f2116afd6e36df7663..cbc7accf051d3ddd7309c933805b9ba13520824f 100644 (file)
@@ -3,6 +3,7 @@
 *************************************************/
 
 /* Copyright (c) Jeremy Harris 2014 - 2018 */
+/* Copyright (c) The Exim Maintainers 2021 */
 
 /* This file provides TLS/SSL support for Exim using the GnuTLS library,
 one of the available supported implementations.  This file is #included into
@@ -288,13 +289,13 @@ uschar * tag = US"";
 uschar * ele;
 int match = -1;
 
-while (mod)
+if (mod) while (*mod)
   {
   if (*mod == '>' && *++mod) sep = *mod++;
-  else if (Ustrcmp(mod, "dns")==0) { match = GNUTLS_SAN_DNSNAME; mod += 3; }
-  else if (Ustrcmp(mod, "uri")==0) { match = GNUTLS_SAN_URI; mod += 3; }
-  else if (Ustrcmp(mod, "mail")==0) { match = GNUTLS_SAN_RFC822NAME; mod += 4; }
-  else continue;
+  else if (Ustrncmp(mod, "dns", 3)==0) { match = GNUTLS_SAN_DNSNAME; mod += 3; }
+  else if (Ustrncmp(mod, "uri", 3)==0) { match = GNUTLS_SAN_URI; mod += 3; }
+  else if (Ustrncmp(mod, "mail", 4)==0) { match = GNUTLS_SAN_RFC822NAME; mod += 4; }
+  else break;
 
   if (*mod++ != ',')
     break;