From fb5908b1bd30edd2e6ee226cd840d8da39d7377d Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 12 Jun 2016 23:12:55 +0100 Subject: Safety check in deliver_split_address() --- src/src/deliver.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src') 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 == '\\') { -- cgit v1.2.3