Guard routing against a null-deref. Bug 1639
authorJeremy Harris <jgh146exb@wizmail.org>
Fri, 5 Jun 2015 14:30:33 +0000 (15:30 +0100)
committerJeremy Harris <jgh146exb@wizmail.org>
Fri, 5 Jun 2015 14:30:33 +0000 (15:30 +0100)
src/src/route.c

index cdfa6e6b77b7c81a9c2e6e96b8e8344f4bd97f9b..39aed90a3af2e254297e4070aeaa04783cab0e5f 100644 (file)
@@ -1920,24 +1920,23 @@ if (unseen && r->next != NULL)
 /* Unset the address expansions, and return the final result. */
 
 ROUTE_EXIT:
 /* Unset the address expansions, and return the final result. */
 
 ROUTE_EXIT:
-if (yield == DEFER) {
-  if (
-    ((Ustrstr(addr->message, "failed to expand") != NULL) || (Ustrstr(addr->message, "expansion of ") != NULL)) &&
-    (
-      Ustrstr(addr->message, "mysql") != NULL ||
-      Ustrstr(addr->message, "pgsql") != NULL ||
+if (  yield == DEFER
+   && addr->message
+   && (  Ustrstr(addr->message, "failed to expand") != NULL
+      || Ustrstr(addr->message, "expansion of ") != NULL
+      )
+   && (  Ustrstr(addr->message, "mysql") != NULL
+      || Ustrstr(addr->message, "pgsql") != NULL
 #ifdef EXPERIMENTAL_REDIS
 #ifdef EXPERIMENTAL_REDIS
-      Ustrstr(addr->message, "redis") != NULL ||
+      || Ustrstr(addr->message, "redis") != NULL
 #endif
 #endif
-      Ustrstr(addr->message, "sqlite") != NULL ||
-      Ustrstr(addr->message, "ldap:") != NULL ||
-      Ustrstr(addr->message, "ldapdn:") != NULL ||
-      Ustrstr(addr->message, "ldapm:") != NULL
-    )
-  ) {
-    addr->message = string_sprintf("Temporary internal error");
-  }
-}
+      || Ustrstr(addr->message, "sqlite") != NULL
+      || Ustrstr(addr->message, "ldap:") != NULL
+      || Ustrstr(addr->message, "ldapdn:") != NULL
+      || Ustrstr(addr->message, "ldapm:") != NULL
+      )
+   )
+  addr->message = string_sprintf("Temporary internal error");
 
 deliver_set_expansions(NULL);
 router_name = NULL;
 
 deliver_set_expansions(NULL);
 router_name = NULL;