summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2016-06-12 23:12:55 +0100
committerJeremy Harris <jgh146exb@wizmail.org>2016-06-12 23:12:55 +0100
commitfb5908b1bd30edd2e6ee226cd840d8da39d7377d (patch)
tree18a99c506f4532df82a0bb7243e50977a9a61c6c /src
parentea90b71819daaacf691fb3ec5526397d12790c62 (diff)
Safety check in deliver_split_address()
Diffstat (limited to 'src')
-rw-r--r--src/src/deliver.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/src/deliver.c b/src/src/deliver.c
index b389c3731..f99aa1819 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -4722,13 +4722,17 @@ Returns: OK
*/
int
-deliver_split_address(address_item *addr)
+deliver_split_address(address_item * addr)
{
-uschar *address = addr->address;
-uschar *domain = Ustrrchr(address, '@');
-uschar *t;
-int len = domain - address;
+uschar * address = addr->address;
+uschar * domain;
+uschar * t;
+int len;
+if (!(domain = Ustrrchr(address, '@')))
+ return DEFER; /* should always have a domain, but just in case... */
+
+len = domain - address;
addr->domain = string_copylc(domain+1); /* Domains are always caseless */
/* The implication in the RFCs (though I can't say I've seen it spelled out
@@ -4740,7 +4744,7 @@ removing quoting backslashes and any unquoted doublequotes. */
t = addr->cc_local_part = store_get(len+1);
while(len-- > 0)
{
- register int c = *address++;
+ int c = *address++;
if (c == '\"') continue;
if (c == '\\')
{