X-Git-Url: https://git.exim.org/exim.git/blobdiff_plain/384152a6b0cce686255894a502e4b88743abd356..d291c7670e4c370cdc4f631ea58f82c7f4f87823:/src/src/srs.c diff --git a/src/src/srs.c b/src/src/srs.c index 6d49a6d27..1ff391f65 100644 --- a/src/src/srs.c +++ b/src/src/srs.c @@ -1,11 +1,10 @@ -/* $Cambridge: exim/src/src/srs.c,v 1.5 2005/05/24 08:15:02 tom Exp $ */ - /************************************************* * Exim - an Internet mail transport agent * *************************************************/ /* SRS - Sender rewriting scheme support (C)2004 Miles Wilton + Copyright (c) The Exim Maintainers 2016 SRS Support Version: 1.0a @@ -27,13 +26,13 @@ uschar *srs_db_reverse = NULL; int eximsrs_init() { - uschar *list = srs_config; + const uschar *list = srs_config; uschar secret_buf[SRS_MAX_SECRET_LENGTH]; - uschar *secret; + uschar *secret = NULL; uschar sbuf[4]; uschar *sbufp; - // Check if this instance of Exim has not initialized SRS + /* Check if this instance of Exim has not initialized SRS */ if(srs == NULL) { int co = 0; @@ -71,7 +70,7 @@ int eximsrs_init() /* First secret specified in secrets? */ co = 0; list = srs_secrets; - if(secret == NULL) + if(secret == NULL || *secret == '\0') { if((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) == NULL) { @@ -107,7 +106,7 @@ int eximsrs_init() /* Extra secrets? */ while((secret = string_nextinlist(&list, &co, secret_buf, SRS_MAX_SECRET_LENGTH)) != NULL) - srs_add_secret(srs, secret, strnlen(secret, SRS_MAX_SECRET_LENGTH)); + srs_add_secret(srs, secret, (Ustrlen(secret) > SRS_MAX_SECRET_LENGTH) ? SRS_MAX_SECRET_LENGTH : Ustrlen(secret)); DEBUG(D_any) debug_printf("SRS initialized\n");