summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/acl.c6
-rw-r--r--src/src/daemon.c6
-rw-r--r--src/src/deliver.c15
-rw-r--r--src/src/exim.c14
-rw-r--r--src/src/expand.c224
-rw-r--r--src/src/filter.c9
-rw-r--r--src/src/functions.h3
-rw-r--r--src/src/host.c6
-rw-r--r--src/src/imap_utf7.c4
-rw-r--r--src/src/lookups/dnsdb.c31
-rw-r--r--src/src/lookups/ibase.c17
-rw-r--r--src/src/lookups/ldap.c26
-rw-r--r--src/src/lookups/lf_quote.c14
-rw-r--r--src/src/lookups/lsearch.c4
-rw-r--r--src/src/lookups/mysql.c4
-rw-r--r--src/src/lookups/nisplus.c17
-rw-r--r--src/src/lookups/oracle.c24
-rw-r--r--src/src/lookups/pgsql.c4
-rw-r--r--src/src/lookups/redis.c19
-rw-r--r--src/src/lookups/sqlite.c2
-rw-r--r--src/src/mime.c18
-rw-r--r--src/src/pdkim/pdkim.c44
-rw-r--r--src/src/perl.c2
-rw-r--r--src/src/receive.c4
-rw-r--r--src/src/rfc2047.c6
-rw-r--r--src/src/sieve.c56
-rw-r--r--src/src/smtp_in.c74
-rw-r--r--src/src/string.c69
-rw-r--r--src/src/transports/pipe.c27
29 files changed, 366 insertions, 383 deletions
diff --git a/src/src/acl.c b/src/src/acl.c
index 5e3bacfe0..0ab6292e1 100644
--- a/src/src/acl.c
+++ b/src/src/acl.c
@@ -1175,13 +1175,13 @@ do
if (cp[1] == '\0') break;
/* contains embedded newline; needs doubling */
- ret = string_cat(ret, &size, &ptr, s, cp-s+1);
- ret = string_cat(ret, &size, &ptr, US"\n", 1);
+ ret = string_catn(ret, &size, &ptr, s, cp-s+1);
+ ret = string_catn(ret, &size, &ptr, US"\n", 1);
s = cp+1;
}
/* last bit of header */
- ret = string_cat(ret, &size, &ptr, s, cp-s+1); /* newline-sep list */
+ ret = string_catn(ret, &size, &ptr, s, cp-s+1); /* newline-sep list */
}
while((h = h->next));
diff --git a/src/src/daemon.c b/src/src/daemon.c
index b73f76fcf..635b94055 100644
--- a/src/src/daemon.c
+++ b/src/src/daemon.c
@@ -1098,11 +1098,11 @@ if (daemon_listen && !inetd_wait_mode)
{
joinstr[0] = sep;
joinstr[1] = ' ';
- *ptr = string_cat(*ptr, sizeptr, ptrptr, US"<", 1);
+ *ptr = string_catn(*ptr, sizeptr, ptrptr, US"<", 1);
}
- *ptr = string_cat(*ptr, sizeptr, ptrptr, joinstr, 2);
- *ptr = string_cat(*ptr, sizeptr, ptrptr, s, Ustrlen(s));
+ *ptr = string_catn(*ptr, sizeptr, ptrptr, joinstr, 2);
+ *ptr = string_cat (*ptr, sizeptr, ptrptr, s);
}
if (new_smtp_port != NULL)
diff --git a/src/src/deliver.c b/src/src/deliver.c
index 1a9fb7da0..5c6a983fe 100644
--- a/src/src/deliver.c
+++ b/src/src/deliver.c
@@ -703,7 +703,7 @@ if (LOGGING(incoming_interface) && LOGGING(outgoing_interface)
s = LOGGING(outgoing_port)
? string_append(s, sizep, ptrp, 2, US"]:",
string_sprintf("%d", sending_port))
- : string_cat(s, sizep, ptrp, US"]", 1);
+ : string_catn(s, sizep, ptrp, US"]", 1);
}
return s;
}
@@ -914,8 +914,7 @@ if (addr->transport->info->local)
s = string_append(s, &size, &ptr, 2, US" H=", addr->host_list->name);
s = d_log_interface(s, &size, &ptr);
if (addr->shadow_message)
- s = string_cat(s, &size, &ptr, addr->shadow_message,
- Ustrlen(addr->shadow_message));
+ s = string_cat(s, &size, &ptr, addr->shadow_message);
}
/* Remote delivery */
@@ -926,7 +925,7 @@ else
{
s = d_hostlog(s, &size, &ptr, addr);
if (continue_sequence > 1)
- s = string_cat(s, &size, &ptr, US"*", 1);
+ s = string_catn(s, &size, &ptr, US"*", 1);
#ifndef DISABLE_EVENT
deliver_host_address = addr->host_used->address;
@@ -1278,7 +1277,7 @@ else if (result == DEFER || result == PANIC)
log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
- s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
+ s = string_cat(s, &size, &ptr, log_address);
/* Either driver_name contains something and driver_kind contains
" router" or " transport" (note the leading space), or driver_name is
@@ -1298,7 +1297,7 @@ else if (result == DEFER || result == PANIC)
s = string_append(s, &size, &ptr, 2, US" ", driver_kind);
sprintf(CS ss, " defer (%d)", addr->basic_errno);
- s = string_cat(s, &size, &ptr, ss, Ustrlen(ss));
+ s = string_cat(s, &size, &ptr, ss);
if (addr->basic_errno > 0)
s = string_append(s, &size, &ptr, 2, US": ",
@@ -1396,7 +1395,7 @@ else
log_address = string_log_address(addr, LOGGING(all_parents), result == OK);
- s = string_cat(s, &size, &ptr, log_address, Ustrlen(log_address));
+ s = string_cat(s, &size, &ptr, log_address);
if (LOGGING(sender_on_delivery))
s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">");
@@ -4832,7 +4831,7 @@ if (!Ufgets(buffer, sizeof(buffer), f) || Ustrcmp(buffer, "****\n") == 0)
para = store_get(size);
for (;;)
{
- para = string_cat(para, &size, &ptr, buffer, Ustrlen(buffer));
+ para = string_cat(para, &size, &ptr, buffer);
if (!Ufgets(buffer, sizeof(buffer), f) || Ustrcmp(buffer, "****\n") == 0)
break;
}
diff --git a/src/src/exim.c b/src/src/exim.c
index ddb35982d..46e856b7a 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -1136,23 +1136,23 @@ for (t = lpart; !needs_quote && *t != 0; t++)
if (!needs_quote) return lpart;
size = ptr = 0;
-yield = string_cat(NULL, &size, &ptr, US"\"", 1);
+yield = string_catn(NULL, &size, &ptr, US"\"", 1);
for (;;)
{
uschar *nq = US Ustrpbrk(lpart, "\\\"");
if (nq == NULL)
{
- yield = string_cat(yield, &size, &ptr, lpart, Ustrlen(lpart));
+ yield = string_cat(yield, &size, &ptr, lpart);
break;
}
- yield = string_cat(yield, &size, &ptr, lpart, nq - lpart);
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, nq, 1);
+ yield = string_catn(yield, &size, &ptr, lpart, nq - lpart);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, nq, 1);
lpart = nq + 1;
}
-yield = string_cat(yield, &size, &ptr, US"\"", 1);
+yield = string_catn(yield, &size, &ptr, US"\"", 1);
yield[ptr] = 0;
return yield;
}
@@ -1266,7 +1266,7 @@ for (i = 0;; i++)
while (p < ss && isspace(*p)) p++; /* leading space after cont */
}
- yield = string_cat(yield, &size, &ptr, p, ss - p);
+ yield = string_catn(yield, &size, &ptr, p, ss - p);
#ifdef USE_READLINE
if (fn_readline != NULL) free(readline_line);
diff --git a/src/src/expand.c b/src/src/expand.c
index 1c9a3be45..c8d1ffc7d 100644
--- a/src/src/expand.c
+++ b/src/src/expand.c
@@ -1669,9 +1669,8 @@ if (!enable_dollar_recipients) return NULL; else
uschar * s = store_get(size);
for (i = 0; i < recipients_count; i++)
{
- if (i != 0) s = string_cat(s, &size, &ptr, US", ", 2);
- s = string_cat(s, &size, &ptr, recipients_list[i].address,
- Ustrlen(recipients_list[i].address));
+ if (i != 0) s = string_catn(s, &size, &ptr, US", ", 2);
+ s = string_cat(s, &size, &ptr, recipients_list[i].address);
}
s[ptr] = 0; /* string_cat() leaves room */
return s;
@@ -2375,7 +2374,7 @@ switch(cond_type)
lookup_value = NULL;
if (user_msg)
{
- lookup_value = string_cat(NULL, &size, &ptr, user_msg, Ustrlen(user_msg));
+ lookup_value = string_cat(NULL, &size, &ptr, user_msg);
lookup_value[ptr] = '\0';
}
*yield = cond == testfor;
@@ -3177,13 +3176,12 @@ if (*s == '}')
{
if (type[0] == 'i')
{
- if (yes) *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, US"true", 4);
+ if (yes) *yieldptr = string_catn(*yieldptr, sizeptr, ptrptr, US"true", 4);
}
else
{
if (yes && lookup_value)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value,
- Ustrlen(lookup_value));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, lookup_value);
lookup_value = save_lookup;
}
s++;
@@ -3206,7 +3204,7 @@ if (*s++ != '}') goto FAILED_CURLY;
/* If we want the first string, add it to the output */
if (yes)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub1, Ustrlen(sub1));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub1);
/* If this is called from a lookup/env or a (cert)extract, we want to restore
$value to what it was at the start of the item, so that it has this value
@@ -3232,7 +3230,7 @@ if (*s == '{')
/* If we want the second string, add it to the output */
if (!yes)
- *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub2, Ustrlen(sub2));
+ *yieldptr = string_cat(*yieldptr, sizeptr, ptrptr, sub2);
}
/* If there is no second string, but the word "fail" is present when the use of
@@ -3401,9 +3399,9 @@ if (key_num == NULL)
if (Ustrlen(key) > 64)
return NULL;
-hash_source = string_cat(NULL,&size,&offset,key_num,1);
-hash_source = string_cat(hash_source,&size,&offset,daystamp,3);
-hash_source = string_cat(hash_source,&size,&offset,address,Ustrlen(address));
+hash_source = string_catn(NULL, &size, &offset, key_num, 1);
+hash_source = string_catn(hash_source, &size, &offset, daystamp, 3);
+hash_source = string_cat(hash_source, &size, &offset, address);
hash_source[offset] = '\0';
DEBUG(D_expand) debug_printf("prvs: hash source is '%s'\n", hash_source);
@@ -3467,9 +3465,9 @@ while (Ufgets(buffer, sizeof(buffer), f))
{
int len = Ustrlen(buffer);
if (eol && buffer[len-1] == '\n') len--;
- yield = string_cat(yield, sizep, ptrp, buffer, len);
+ yield = string_catn(yield, sizep, ptrp, buffer, len);
if (buffer[len] != 0)
- yield = string_cat(yield, sizep, ptrp, eol, eollen);
+ yield = string_catn(yield, sizep, ptrp, eol, eollen);
}
if (yield) yield[*ptrp] = 0;
@@ -3855,7 +3853,7 @@ while (*s != 0)
{
const uschar * t = s + 2;
for (s = t; *s != 0; s++) if (*s == '\\' && s[1] == 'N') break;
- yield = string_cat(yield, &size, &ptr, t, s - t);
+ yield = string_catn(yield, &size, &ptr, t, s - t);
if (*s != 0) s += 2;
}
@@ -3864,7 +3862,7 @@ while (*s != 0)
uschar ch[1];
ch[0] = string_interpret_escape(&s);
s++;
- yield = string_cat(yield, &size, &ptr, ch, 1);
+ yield = string_catn(yield, &size, &ptr, ch, 1);
}
continue;
@@ -3879,7 +3877,7 @@ while (*s != 0)
if (*s != '$' || !honour_dollar)
{
- yield = string_cat(yield, &size, &ptr, s++, 1);
+ yield = string_catn(yield, &size, &ptr, s++, 1);
continue;
}
@@ -3957,7 +3955,7 @@ while (*s != 0)
size = newsize;
ptr = len;
}
- else yield = string_cat(yield, &size, &ptr, value, len);
+ else yield = string_catn(yield, &size, &ptr, value, len);
continue;
}
@@ -3967,7 +3965,7 @@ while (*s != 0)
int n;
s = read_cnumber(&n, s);
if (n >= 0 && n <= expand_nmax)
- yield = string_cat(yield, &size, &ptr, expand_nstring[n],
+ yield = string_catn(yield, &size, &ptr, expand_nstring[n],
expand_nlength[n]);
continue;
}
@@ -3993,7 +3991,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
if (n >= 0 && n <= expand_nmax)
- yield = string_cat(yield, &size, &ptr, expand_nstring[n],
+ yield = string_catn(yield, &size, &ptr, expand_nstring[n],
expand_nlength[n]);
continue;
}
@@ -4045,7 +4043,7 @@ while (*s != 0)
DEBUG(D_expand)
debug_printf("acl expansion yield: %s\n", user_msg);
if (user_msg)
- yield = string_cat(yield, &size, &ptr, user_msg, Ustrlen(user_msg));
+ yield = string_cat(yield, &size, &ptr, user_msg);
continue;
case DEFER:
@@ -4137,7 +4135,7 @@ while (*s != 0)
sub_arg[1][0], sub_arg[2], &expand_string_message)))
goto EXPAND_FAILED;
if (!skipping)
- yield = string_cat(yield, &size, &ptr, encoded, Ustrlen(encoded));
+ yield = string_cat(yield, &size, &ptr, encoded);
continue;
}
#endif
@@ -4466,14 +4464,14 @@ while (*s != 0)
/* Now separate the domain from the local part */
*domain++ = '\0';
- yield = string_cat(yield,&size,&ptr,US"prvs=",5);
- string_cat(yield,&size,&ptr,(sub_arg[2] != NULL) ? sub_arg[2] : US"0", 1);
- string_cat(yield,&size,&ptr,prvs_daystamp(7),3);
- string_cat(yield,&size,&ptr,p,6);
- string_cat(yield,&size,&ptr,US"=",1);
- string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
- string_cat(yield,&size,&ptr,US"@",1);
- string_cat(yield,&size,&ptr,domain,Ustrlen(domain));
+ yield = string_catn(yield, &size, &ptr, US"prvs=", 5);
+ yield = string_catn(yield, &size, &ptr, sub_arg[2] ? sub_arg[2] : US"0", 1);
+ yield = string_catn(yield, &size, &ptr, prvs_daystamp(7), 3);
+ yield = string_catn(yield, &size, &ptr, p, 6);
+ yield = string_catn(yield, &size, &ptr, US"=", 1);
+ yield = string_cat (yield, &size, &ptr, sub_arg[0]);
+ yield = string_catn(yield, &size, &ptr, US"@", 1);
+ yield = string_cat (yield, &size, &ptr, domain);
continue;
}
@@ -4527,9 +4525,9 @@ while (*s != 0)
DEBUG(D_expand) debug_printf("prvscheck domain: %s\n", domain);
/* Set up expansion variables */
- prvscheck_address = string_cat(NULL, &mysize, &myptr, local_part, Ustrlen(local_part));
- string_cat(prvscheck_address,&mysize,&myptr,US"@",1);
- string_cat(prvscheck_address,&mysize,&myptr,domain,Ustrlen(domain));
+ prvscheck_address = string_cat (NULL, &mysize, &myptr, local_part);
+ prvscheck_address = string_catn(prvscheck_address, &mysize, &myptr, US"@", 1);
+ prvscheck_address = string_cat (prvscheck_address, &mysize, &myptr, domain);
prvscheck_address[myptr] = '\0';
prvscheck_keynum = string_copy(key_num);
@@ -4595,10 +4593,8 @@ while (*s != 0)
case 3: goto EXPAND_FAILED;
}
- if (sub_arg[0] == NULL || *sub_arg[0] == '\0')
- yield = string_cat(yield,&size,&ptr,prvscheck_address,Ustrlen(prvscheck_address));
- else
- yield = string_cat(yield,&size,&ptr,sub_arg[0],Ustrlen(sub_arg[0]));
+ yield = string_cat(yield, &size, &ptr,
+ !sub_arg[0] || !*sub_arg[0] ? prvscheck_address : sub_arg[0]);
/* Reset the "internal" variables afterwards, because they are in
dynamic store that will be reclaimed if the expansion succeeded. */
@@ -4858,9 +4854,9 @@ while (*s != 0)
SOCK_FAIL:
if (*s != '{') goto EXPAND_FAILED;
DEBUG(D_any) debug_printf("%s\n", expand_string_message);
- arg = expand_string_internal(s+1, TRUE, &s, FALSE, TRUE, &resetok);
- if (arg == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, arg, Ustrlen(arg));
+ if (!(arg = expand_string_internal(s+1, TRUE, &s, FALSE, TRUE, &resetok)))
+ goto EXPAND_FAILED;
+ yield = string_cat(yield, &size, &ptr, arg);
if (*s++ != '}') goto EXPAND_FAILED_CURLY;
while (isspace(*s)) s++;
if (*s++ != '}') goto EXPAND_FAILED_CURLY;
@@ -4991,7 +4987,7 @@ while (*s != 0)
case 3: goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, sub[0], Ustrlen(sub[0]));
+ yield = string_cat(yield, &size, &ptr, sub[0]);
o2m = Ustrlen(sub[2]) - 1;
if (o2m >= 0) for (; oldptr < ptr; oldptr++)
@@ -5068,7 +5064,7 @@ while (*s != 0)
extract_substr(sub[2], val[0], val[1], &len);
if (ret == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, ret, len);
+ yield = string_catn(yield, &size, &ptr, ret, len);
continue;
}
@@ -5176,7 +5172,7 @@ while (*s != 0)
DEBUG(D_any) debug_printf("HMAC[%s](%.*s,%.*s)=%.*s\n", sub[0],
(int)keylen, keyptr, Ustrlen(sub[2]), sub[2], hashlen*2, finalhash_hex);
- yield = string_cat(yield, &size, &ptr, finalhash_hex, hashlen*2);
+ yield = string_catn(yield, &size, &ptr, finalhash_hex, hashlen*2);
}
continue;
@@ -5247,7 +5243,7 @@ while (*s != 0)
emptyopt = 0;
continue;
}
- yield = string_cat(yield, &size, &ptr, subject+moffset, slen-moffset);
+ yield = string_catn(yield, &size, &ptr, subject+moffset, slen-moffset);
break;
}
@@ -5264,11 +5260,11 @@ while (*s != 0)
/* Copy the characters before the match, plus the expanded insertion. */
- yield = string_cat(yield, &size, &ptr, subject + moffset,
+ yield = string_catn(yield, &size, &ptr, subject + moffset,
ovector[0] - moffset);
insert = expand_string(sub[2]);
if (insert == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, insert, Ustrlen(insert));
+ yield = string_cat(yield, &size, &ptr, insert);
moffset = ovector[1];
moffsetextra = 0;
@@ -5704,7 +5700,7 @@ while (*s != 0)
separator character, or is an empty string. */
if (ptr != save_ptr && (temp[0] == *outsep || temp[0] == 0))
- yield = string_cat(yield, &size, &ptr, US" ", 1);
+ yield = string_catn(yield, &size, &ptr, US" ", 1);
/* Add the string in "temp" to the output list that we are building,
This is done in chunks by searching for the separator character. */
@@ -5712,21 +5708,22 @@ while (*s != 0)
for (;;)
{
size_t seglen = Ustrcspn(temp, outsep);
- yield = string_cat(yield, &size, &ptr, temp, seglen + 1);
+
+ yield = string_catn(yield, &size, &ptr, temp, seglen + 1);
/* If we got to the end of the string we output one character
too many; backup and end the loop. Otherwise arrange to double the
separator. */
if (temp[seglen] == '\0') { ptr--; break; }
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
temp += seglen + 1;
}
/* Output a separator after the string: we will remove the redundant
final one at the end. */
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
} /* End of iteration over the list loop */
/* REDUCE has generated no output above: output the final value of
@@ -5734,8 +5731,7 @@ while (*s != 0)
if (item_type == EITEM_REDUCE)
{
- yield = string_cat(yield, &size, &ptr, lookup_value,
- Ustrlen(lookup_value));
+ yield = string_cat(yield, &size, &ptr, lookup_value);
lookup_value = save_lookup_value; /* Restore $value */
}
@@ -5878,7 +5874,7 @@ while (*s != 0)
}
if (dstlist)
- yield = string_cat(yield, &size, &ptr, dstlist, Ustrlen(dstlist));
+ yield = string_cat(yield, &size, &ptr, dstlist);
/* Restore preserved $item */
iterate_item = save_iterate_item;
@@ -5976,7 +5972,7 @@ while (*s != 0)
if(status == OK)
{
if (result == NULL) result = US"";
- yield = string_cat(yield, &size, &ptr, result, Ustrlen(result));
+ yield = string_cat(yield, &size, &ptr, result);
continue;
}
else
@@ -6106,7 +6102,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
t = string_base62(n);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
@@ -6130,7 +6126,7 @@ while (*s != 0)
n = n * BASE_62 + (t - base62_chars);
}
(void)sprintf(CS buf, "%ld", n);
- yield = string_cat(yield, &size, &ptr, buf, Ustrlen(buf));
+ yield = string_cat(yield, &size, &ptr, buf);
continue;
}
@@ -6144,7 +6140,7 @@ while (*s != 0)
expand_string_message);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, expanded, Ustrlen(expanded));
+ yield = string_cat(yield, &size, &ptr, expanded);
continue;
}
@@ -6153,7 +6149,7 @@ while (*s != 0)
int count = 0;
uschar *t = sub - 1;
while (*(++t) != 0) { *t = tolower(*t); count++; }
- yield = string_cat(yield, &size, &ptr, sub, count);
+ yield = string_catn(yield, &size, &ptr, sub, count);
continue;
}
@@ -6162,7 +6158,7 @@ while (*s != 0)
int count = 0;
uschar *t = sub - 1;
while (*(++t) != 0) { *t = toupper(*t); count++; }
- yield = string_cat(yield, &size, &ptr, sub, count);
+ yield = string_catn(yield, &size, &ptr, sub, count);
continue;
}
@@ -6171,7 +6167,7 @@ while (*s != 0)
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_md5(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
@@ -6183,7 +6179,7 @@ while (*s != 0)
md5_start(&base);
md5_end(&base, sub, Ustrlen(sub), digest);
for(j = 0; j < 16; j++) sprintf(st+2*j, "%02x", digest[j]);
- yield = string_cat(yield, &size, &ptr, US st, (int)strlen(st));
+ yield = string_cat(yield, &size, &ptr, US st);
}
continue;
@@ -6192,7 +6188,7 @@ while (*s != 0)
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_sha1(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
@@ -6204,7 +6200,7 @@ while (*s != 0)
sha1_start(&base);
sha1_end(&base, sub, Ustrlen(sub), digest);
for(j = 0; j < 20; j++) sprintf(st+2*j, "%02X", digest[j]);
- yield = string_cat(yield, &size, &ptr, US st, (int)strlen(st));
+ yield = string_cat(yield, &size, &ptr, US st);
}
continue;
@@ -6213,7 +6209,7 @@ while (*s != 0)
if (vp && *(void **)vp->value)
{
uschar * cp = tls_cert_fprt_sha256(*(void **)vp->value);
- yield = string_cat(yield, &size, &ptr, cp, (int)Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
}
else
#endif
@@ -6264,7 +6260,7 @@ while (*s != 0)
}
enc = b64encode(sub, out - sub);
- yield = string_cat(yield, &size, &ptr, enc, Ustrlen(enc));
+ yield = string_cat(yield, &size, &ptr, enc);
continue;
}
@@ -6276,10 +6272,10 @@ while (*s != 0)
while (*(++t) != 0)
{
if (*t < 0x21 || 0x7E < *t)
- yield = string_cat(yield, &size, &ptr,
+ yield = string_catn(yield, &size, &ptr,
string_sprintf("\\x%02x", *t), 4);
else
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
continue;
}
@@ -6295,7 +6291,7 @@ while (*s != 0)
while (string_nextinlist(CUSS &sub, &sep, buffer, sizeof(buffer)) != NULL) cnt++;
cp = string_sprintf("%d", cnt);
- yield = string_cat(yield, &size, &ptr, cp, Ustrlen(cp));
+ yield = string_cat(yield, &size, &ptr, cp);
continue;
}
@@ -6349,7 +6345,7 @@ while (*s != 0)
{
uschar * buf = US" : ";
if (needsep)
- yield = string_cat(yield, &size, &ptr, buf, 3);
+ yield = string_catn(yield, &size, &ptr, buf, 3);
else
needsep = TRUE;
@@ -6365,21 +6361,21 @@ while (*s != 0)
tok[0] = sep; tok[1] = ':'; tok[2] = 0;
while ((cp= strpbrk((const char *)item, tok)))
{
- yield = string_cat(yield, &size, &ptr, item, cp-(char *)item);
+ yield = string_catn(yield, &size, &ptr, item, cp-(char *)item);
if (*cp++ == ':') /* colon in a non-colon-sep list item, needs doubling */
{
- yield = string_cat(yield, &size, &ptr, US"::", 2);
+ yield = string_catn(yield, &size, &ptr, US"::", 2);
item = (uschar *)cp;
}
else /* sep in item; should already be doubled; emit once */
{
- yield = string_cat(yield, &size, &ptr, (uschar *)tok, 1);
+ yield = string_catn(yield, &size, &ptr, (uschar *)tok, 1);
if (*cp == sep) cp++;
item = (uschar *)cp;
}
}
}
- yield = string_cat(yield, &size, &ptr, item, Ustrlen(item));
+ yield = string_cat(yield, &size, &ptr, item);
}
continue;
}
@@ -6427,7 +6423,7 @@ while (*s != 0)
/* Convert to masked textual format and add to output. */
- yield = string_cat(yield, &size, &ptr, buffer,
+ yield = string_catn(yield, &size, &ptr, buffer,
host_nmtoa(count, binary, mask, buffer, '.'));
continue;
}
@@ -6457,7 +6453,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, buffer,
+ yield = string_catn(yield, &size, &ptr, buffer,
c == EOP_IPV6NORM
? ipv6_nmtoa(binary, buffer)
: host_nmtoa(4, binary, -1, buffer, ':')
@@ -6478,12 +6474,12 @@ while (*s != 0)
if (c != EOP_DOMAIN)
{
if (c == EOP_LOCAL_PART && domain != 0) end = start + domain - 1;
- yield = string_cat(yield, &size, &ptr, sub+start, end-start);
+ yield = string_catn(yield, &size, &ptr, sub+start, end-start);
}
else if (domain != 0)
{
domain += start;
- yield = string_cat(yield, &size, &ptr, sub+domain, end-domain);
+ yield = string_catn(yield, &size, &ptr, sub+domain, end-domain);
}
}
continue;
@@ -6518,25 +6514,25 @@ while (*s != 0)
if (address != NULL)
{
if (ptr != save_ptr && address[0] == *outsep)
- yield = string_cat(yield, &size, &ptr, US" ", 1);
+ yield = string_catn(yield, &size, &ptr, US" ", 1);
for (;;)
{
size_t seglen = Ustrcspn(address, outsep);
- yield = string_cat(yield, &size, &ptr, address, seglen + 1);
+ yield = string_catn(yield, &size, &ptr, address, seglen + 1);
/* If we got to the end of the string we output one character
too many. */
if (address[seglen] == '\0') { ptr--; break; }
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
address += seglen + 1;
}
/* Output a separator after the string: we will remove the
redundant final one at the end. */
- yield = string_cat(yield, &size, &ptr, outsep, 1);
+ yield = string_catn(yield, &size, &ptr, outsep, 1);
}
if (saveend == '\0') break;
@@ -6583,24 +6579,24 @@ while (*s != 0)
if (needs_quote)
{
- yield = string_cat(yield, &size, &ptr, US"\"", 1);
+ yield = string_catn(yield, &size, &ptr, US"\"", 1);
t = sub - 1;
while (*(++t) != 0)
{
if (*t == '\n')
- yield = string_cat(yield, &size, &ptr, US"\\n", 2);
+ yield = string_catn(yield, &size, &ptr, US"\\n", 2);
else if (*t == '\r')
- yield = string_cat(yield, &size, &ptr, US"\\r", 2);
+ yield = string_catn(yield, &size, &ptr, US"\\r", 2);
else
{
if (*t == '\\' || *t == '"')
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
}
- yield = string_cat(yield, &size, &ptr, US"\"", 1);
+ yield = string_catn(yield, &size, &ptr, US"\"", 1);
}
- else yield = string_cat(yield, &size, &ptr, sub, Ustrlen(sub));
+ else yield = string_cat(yield, &size, &ptr, sub);
continue;
}
@@ -6632,7 +6628,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, sub, Ustrlen(sub));
+ yield = string_cat(yield, &size, &ptr, sub);
continue;
}
@@ -6645,8 +6641,8 @@ while (*s != 0)
while (*(++t) != 0)
{
if (!isalnum(*t))
- yield = string_cat(yield, &size, &ptr, US"\\", 1);
- yield = string_cat(yield, &size, &ptr, t, 1);
+ yield = string_catn(yield, &size, &ptr, US"\\", 1);
+ yield = string_catn(yield, &size, &ptr, t, 1);
}
continue;
}
@@ -6659,7 +6655,7 @@ while (*s != 0)
uschar buffer[2048];
const uschar *string = parse_quote_2047(sub, Ustrlen(sub), headers_charset,
buffer, sizeof(buffer), FALSE);
- yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
+ yield = string_cat(yield, &size, &ptr, string);
continue;
}
@@ -6676,7 +6672,7 @@ while (*s != 0)
expand_string_message = error;
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, decoded, len);
+ yield = string_catn(yield, &size, &ptr, decoded, len);
continue;
}
@@ -6692,7 +6688,7 @@ while (*s != 0)
GETUTF8INC(c, sub);
if (c > 255) c = '_';
buff[0] = c;
- yield = string_cat(yield, &size, &ptr, buff, 1);
+ yield = string_catn(yield, &size, &ptr, buff, 1);
}
continue;
}
@@ -6727,7 +6723,7 @@ while (*s != 0)
complete = -1; /* error (RFC3629 limit) */
else
{ /* finished; output utf-8 sequence */
- yield = string_cat(yield, &size, &ptr, seq_buff, seq_len);
+ yield = string_catn(yield, &size, &ptr, seq_buff, seq_len);
index = 0;
}
}
@@ -6736,7 +6732,7 @@ while (*s != 0)
{
if((c & 0x80) == 0) /* 1-byte sequence, US-ASCII, keep it */
{
- yield = string_cat(yield, &size, &ptr, &c, 1);
+ yield = string_catn(yield, &size, &ptr, &c, 1);
continue;
}
if((c & 0xe0) == 0xc0) /* 2-byte sequence */
@@ -6769,11 +6765,11 @@ while (*s != 0)
if (complete != 0)
{
bytes_left = index = 0;
- yield = string_cat(yield, &size, &ptr, UTF8_REPLACEMENT_CHAR, 1);
+ yield = string_catn(yield, &size, &ptr, UTF8_REPLACEMENT_CHAR, 1);
}
if ((complete == 1) && ((c & 0x80) == 0))
/* ASCII character follows incomplete sequence */
- yield = string_cat(yield, &size, &ptr, &c, 1);
+ yield = string_catn(yield, &size, &ptr, &c, 1);
}
continue;
}
@@ -6790,7 +6786,7 @@ while (*s != 0)
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -6805,7 +6801,7 @@ while (*s != 0)
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -6820,7 +6816,7 @@ while (*s != 0)
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
DEBUG(D_expand) debug_printf("yield: '%s'\n", yield);
continue;
}
@@ -6836,7 +6832,7 @@ while (*s != 0)
string_printing(sub), error);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
#endif /* EXPERIMENTAL_INTERNATIONAL */
@@ -6846,7 +6842,7 @@ while (*s != 0)
case EOP_ESCAPE:
{
const uschar *t = string_printing(sub);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
@@ -6866,7 +6862,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
sprintf(CS var_buffer, PR_EXIM_ARITH, n);
- yield = string_cat(yield, &size, &ptr, var_buffer, Ustrlen(var_buffer));
+ yield = string_cat(yield, &size, &ptr, var_buffer);
continue;
}
@@ -6882,7 +6878,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
sprintf(CS var_buffer, "%d", n);
- yield = string_cat(yield, &size, &ptr, var_buffer, Ustrlen(var_buffer));
+ yield = string_cat(yield, &size, &ptr, var_buffer);
continue;
}
@@ -6897,7 +6893,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
t = readconf_printtime(n);
- yield = string_cat(yield, &size, &ptr, t, Ustrlen(t));
+ yield = string_cat(yield, &size, &ptr, t);
continue;
}
@@ -6913,7 +6909,7 @@ while (*s != 0)
#else
uschar * s = b64encode(sub, Ustrlen(sub));
#endif
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -6927,7 +6923,7 @@ while (*s != 0)
"well-formed for \"%s\" operator", sub, name);
goto EXPAND_FAILED;
}
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -6937,7 +6933,7 @@ while (*s != 0)
{
uschar buff[24];
(void)sprintf(CS buff, "%d", Ustrlen(sub));
- yield = string_cat(yield, &size, &ptr, buff, Ustrlen(buff));
+ yield = string_cat(yield, &size, &ptr, buff);
continue;
}
@@ -7028,7 +7024,7 @@ while (*s != 0)
extract_substr(sub, value1, value2, &len);
if (ret == NULL) goto EXPAND_FAILED;
- yield = string_cat(yield, &size, &ptr, ret, len);
+ yield = string_catn(yield, &size, &ptr, ret, len);
continue;
}
@@ -7083,7 +7079,7 @@ while (*s != 0)
(long)st.st_dev, (long)st.st_nlink, (long)st.st_uid,
(long)st.st_gid, st.st_size, (long)st.st_atime,
(long)st.st_mtime, (long)st.st_ctime);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -7098,7 +7094,7 @@ while (*s != 0)
if (expand_string_message != NULL)
goto EXPAND_FAILED;
s = string_sprintf("%d", vaguely_random_number((int)max));
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
continue;
}
@@ -7117,7 +7113,7 @@ while (*s != 0)
goto EXPAND_FAILED;
}
invert_address(reversed, sub);
- yield = string_cat(yield, &size, &ptr, reversed, Ustrlen(reversed));
+ yield = string_cat(yield, &size, &ptr, reversed);
continue;
}
@@ -7162,7 +7158,7 @@ while (*s != 0)
size = newsize;
ptr = len;
}
- else yield = string_cat(yield, &size, &ptr, value, len);
+ else yield = string_catn(yield, &size, &ptr, value, len);
continue;
}
diff --git a/src/src/filter.c b/src/src/filter.c
index bba1a520e..f6e9b4655 100644
--- a/src/src/filter.c
+++ b/src/src/filter.c
@@ -2281,17 +2281,16 @@ while (commands != NULL)
if (recipient != NULL)
{
- log_addr = string_cat(log_addr, &size, &ptr,
- (log_addr == NULL)? US">" : US",", 1);
- log_addr = string_cat(log_addr, &size, &ptr, recipient,
- Ustrlen(recipient));
+ log_addr = string_catn(log_addr, &size, &ptr,
+ log_addr ? US"," : US">", 1);
+ log_addr = string_cat(log_addr, &size, &ptr, recipient);
}
/* Check size */
if (ptr > 256)
{
- log_addr = string_cat(log_addr, &size, &ptr, US", ...", 5);
+ log_addr = string_catn(log_addr, &size, &ptr, US", ...", 5);
break;
}
diff --git a/src/src/functions.h b/src/src/functions.h
index beae00934..4fbabcd81 100644
--- a/src/src/functions.h
+++ b/src/src/functions.h
@@ -417,7 +417,8 @@ extern uschar *string_append(uschar *, int *, int *, int, ...);
extern uschar *string_append_listele(uschar *, uschar, const uschar *);
extern uschar *string_append_listele_n(uschar *, uschar, const uschar *, unsigned);
extern uschar *string_base62(unsigned long int);
-extern uschar *string_cat(uschar *, int *, int *, const uschar *, int);
+extern uschar *string_cat(uschar *, int *, int *, const uschar *);
+extern uschar *string_catn(uschar *, int *, int *, const uschar *, int);
extern int string_compare_by_pointer(const void *, const void *);
extern uschar *string_copy_dnsdomain(uschar *);
extern uschar *string_copy_malloc(const uschar *);
diff --git a/src/src/host.c b/src/src/host.c
index 7bfa312ed..7fda13d3c 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -597,12 +597,12 @@ if (sender_host_name == NULL)
sender_fullhost = (sender_helo_name == NULL)? address :
string_sprintf("(%s) %s", sender_helo_name, address);
- sender_rcvhost = string_cat(NULL, &size, &ptr, address, adlen);
+ sender_rcvhost = string_catn(NULL, &size, &ptr, address, adlen);
if (sender_ident != NULL || show_helo || portptr != NULL)
{
int firstptr;
- sender_rcvhost = string_cat(sender_rcvhost, &size, &ptr, US" (", 2);
+ sender_rcvhost = string_catn(sender_rcvhost, &size, &ptr, US" (", 2);
firstptr = ptr;
if (portptr != NULL)
@@ -617,7 +617,7 @@ if (sender_host_name == NULL)
sender_rcvhost = string_append(sender_rcvhost, &size, &ptr, 2,
(firstptr == ptr)? US"ident=" : US" ident=", sender_ident);
- sender_rcvhost = string_cat(sender_rcvhost, &size, &ptr, US")", 1);
+ sender_rcvhost = string_catn(sender_rcvhost, &size, &ptr, US")", 1);
}
sender_rcvhost[ptr] = 0; /* string_cat() always leaves room */
diff --git a/src/src/imap_utf7.c b/src/src/imap_utf7.c
index dcccaeef8..267d600c3 100644
--- a/src/src/imap_utf7.c
+++ b/src/src/imap_utf7.c
@@ -171,7 +171,7 @@ while (slen > 0)
if (outptr > outbuf + sizeof(outbuf) - 3)
{
- yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
+ yield = string_catn(yield, &size, &ptr, outbuf, outptr - outbuf);
outptr = outbuf;
}
@@ -197,7 +197,7 @@ if (base64mode)
iconv_close(icd);
#endif
-yield = string_cat(yield, &size, &ptr, outbuf, outptr - outbuf);
+yield = string_catn(yield, &size, &ptr, outbuf, outptr - outbuf);
if (yield[ptr-1] == '.')
ptr--;
yield[ptr] = '\0';
diff --git a/src/src/lookups/dnsdb.c b/src/src/lookups/dnsdb.c
index 70e6c8c63..da3495beb 100644
--- a/src/src/lookups/dnsdb.c
+++ b/src/src/lookups/dnsdb.c
@@ -396,9 +396,8 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
dns_address *da;
for (da = dns_address_from_rr(&dnsa, rr); da; da = da->next)
{
- if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
- yield = string_cat(yield, &size, &ptr, da->address,
- Ustrlen(da->address));
+ if (ptr != 0) yield = string_catn(yield, &size, &ptr, outsep, 1);
+ yield = string_cat(yield, &size, &ptr, da->address);
}
continue;
}
@@ -406,14 +405,14 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
/* Other kinds of record just have one piece of data each, but there may be
several of them, of course. */
- if (ptr != 0) yield = string_cat(yield, &size, &ptr, outsep, 1);
+ if (ptr != 0) yield = string_catn(yield, &size, &ptr, outsep, 1);
if (type == T_TXT || type == T_SPF)
{
if (outsep2 == NULL)
{
/* output only the first item of data */
- yield = string_cat(yield, &size, &ptr, (uschar *)(rr->data+1),
+ yield = string_catn(yield, &size, &ptr, (uschar *)(rr->data+1),
(rr->data)[0]);
}
else
@@ -424,9 +423,9 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
{
uschar chunk_len = (rr->data)[data_offset++];
if (outsep2[0] != '\0' && data_offset != 1)
- yield = string_cat(yield, &size, &ptr, outsep2, 1);
- yield = string_cat(yield, &size, &ptr,
- (uschar *)((rr->data)+data_offset), chunk_len);
+ yield = string_catn(yield, &size, &ptr, outsep2, 1);
+ yield = string_catn(yield, &size, &ptr,
+ US ((rr->data)+data_offset), chunk_len);
data_offset += chunk_len;
}
}
@@ -452,7 +451,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
i++)
sp += sprintf(CS sp, "%02x", (unsigned char)p[i]);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
else /* T_CNAME, T_CSA, T_MX, T_MXH, T_NS, T_PTR, T_SOA, T_SRV */
{
@@ -470,7 +469,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
case T_MX:
GETSHORT(priority, p);
sprintf(CS s, "%d%c", priority, *outsep2);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
break;
case T_SRV:
@@ -479,7 +478,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
GETSHORT(port, p);
sprintf(CS s, "%d%c%d%c%d%c", priority, *outsep2,
weight, *outsep2, port, *outsep2);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
break;
case T_CSA:
@@ -508,7 +507,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
}
s[1] = ' ';
- yield = string_cat(yield, &size, &ptr, s, 2);
+ yield = string_catn(yield, &size, &ptr, s, 2);
break;
default:
@@ -529,14 +528,14 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
"domain=%s", dns_text_type(type), domain);
break;
}
- else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ else yield = string_cat(yield, &size, &ptr, s);
if (type == T_SOA && outsep2 != NULL)
{
unsigned long serial, refresh, retry, expire, minimum;
p += rc;
- yield = string_cat(yield, &size, &ptr, outsep2, 1);
+ yield = string_catn(yield, &size, &ptr, outsep2, 1);
rc = dn_expand(dnsa.answer, dnsa.answer + dnsa.answerlen, p,
(DN_EXPAND_ARG4_TYPE)s, sizeof(s));
@@ -546,7 +545,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
"domain=%s", dns_text_type(type), domain);
break;
}
- else yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ else yield = string_cat(yield, &size, &ptr, s);
p += rc;
GETLONG(serial, p); GETLONG(refresh, p);
@@ -554,7 +553,7 @@ while ((domain = string_nextinlist(&keystring, &sep, NULL, 0)))
sprintf(CS s, "%c%lu%c%lu%c%lu%c%lu%c%lu",
*outsep2, serial, *outsep2, refresh,
*outsep2, retry, *outsep2, expire, *outsep2, minimum);
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
}
} /* Loop for list of returned records */
diff --git a/src/src/lookups/ibase.c b/src/src/lookups/ibase.c
index 10c962019..6405a6448 100644
--- a/src/src/lookups/ibase.c
+++ b/src/src/lookups/ibase.c
@@ -353,14 +353,14 @@ has the password removed. This copy is also used for debugging output. */
}
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US "\n", 1);
+ result = string_catn(result, &ssize, &offset, US "\n", 1);
/* Find the number of fields returned. If this is one, we don't add field
names to the data. Otherwise we do. */
if (out_sqlda->sqld == 1) {
if (out_sqlda->sqlvar[0].sqlind == NULL || *out_sqlda->sqlvar[0].sqlind != -1) /* NULL value yields nothing */
result =
- string_cat(result, &ssize, &offset, US buffer,
+ string_catn(result, &ssize, &offset, US buffer,
fetch_field(buffer, sizeof(buffer),
&out_sqlda->sqlvar[0]));
}
@@ -374,19 +374,19 @@ has the password removed. This copy is also used for debugging output. */
string_cat(result, &ssize, &offset,
US out_sqlda->sqlvar[i].aliasname,
out_sqlda->sqlvar[i].aliasname_length);
- result = string_cat(result, &ssize, &offset, US "=", 1);
+ result = string_catn(result, &ssize, &offset, US "=", 1);
/* Quote the value if it contains spaces or is empty */
if (*out_sqlda->sqlvar[i].sqlind == -1) { /* NULL value */
result =
- string_cat(result, &ssize, &offset, US "\"\"", 2);
+ string_catn(result, &ssize, &offset, US "\"\"", 2);
}
else if (buffer[0] == 0 || Ustrchr(buffer, ' ') != NULL) {
int j;
result =
- string_cat(result, &ssize, &offset, US "\"", 1);
+ string_catn(result, &ssize, &offset, US "\"", 1);
for (j = 0; j < len; j++) {
if (buffer[j] == '\"' || buffer[j] == '\\')
result =
@@ -397,13 +397,12 @@ has the password removed. This copy is also used for debugging output. */
US buffer + j, 1);
}
result =
- string_cat(result, &ssize, &offset, US "\"", 1);
+ string_catn(result, &ssize, &offset, US "\"", 1);
} else {
result =
- string_cat(result, &ssize, &offset, US buffer,
- len);
+ string_catn(result, &ssize, &offset, US buffer, len);
}
- result = string_cat(result, &ssize, &offset, US " ", 1);
+ result = string_catn(result, &ssize, &offset, US " ", 1);
}
}
diff --git a/src/src/lookups/ldap.c b/src/src/lookups/ldap.c
index 40c84b1ad..3db787cce 100644
--- a/src/src/lookups/ldap.c
+++ b/src/src/lookups/ldap.c
@@ -734,7 +734,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
/* Results for multiple entries values are separated by newlines. */
- if (data != NULL) data = string_cat(data, &size, &ptr, US"\n", 1);
+ if (data != NULL) data = string_catn(data, &size, &ptr, US"\n", 1);
/* Get the DN from the last result. */
@@ -762,7 +762,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
{ /* condition, because of the else */
if (new_dn != NULL) /* below, that's for the first only */
{
- data = string_cat(data, &size, &ptr, new_dn, Ustrlen(new_dn));
+ data = string_cat(data, &size, &ptr, new_dn);
data[ptr] = 0;
attribute_found = TRUE;
}
@@ -796,11 +796,11 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
if (attrs_requested != 1)
{
if (insert_space)
- data = string_cat(data, &size, &ptr, US" ", 1);
+ data = string_catn(data, &size, &ptr, US" ", 1);
else
insert_space = TRUE;
- data = string_cat(data, &size, &ptr, attr, Ustrlen(attr));
- data = string_cat(data, &size, &ptr, US"=\"", 2);
+ data = string_cat(data, &size, &ptr, attr);
+ data = string_catn(data, &size, &ptr, US"=\"", 2);
}
while (*values != NULL)
@@ -818,7 +818,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
attribute and append only every non first value. */
if (data && valuecount > 1)
- data = string_cat(data, &size, &ptr, US",", 1);
+ data = string_catn(data, &size, &ptr, US",", 1);
/* For multiple attributes, the data is in quotes. We must escape
internal quotes, backslashes, newlines, and must double commas. */
@@ -829,14 +829,14 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
for (j = 0; j < len; j++)
{
if (value[j] == '\n')
- data = string_cat(data, &size, &ptr, US"\\n", 2);
+ data = string_catn(data, &size, &ptr, US"\\n", 2);
else if (value[j] == ',')
- data = string_cat(data, &size, &ptr, US",,", 2);
+ data = string_catn(data, &size, &ptr, US",,", 2);
else
{
if (value[j] == '\"' || value[j] == '\\')
- data = string_cat(data, &size, &ptr, US"\\", 1);
- data = string_cat(data, &size, &ptr, value+j, 1);
+ data = string_catn(data, &size, &ptr, US"\\", 1);
+ data = string_catn(data, &size, &ptr, value+j, 1);
}
}
}
@@ -848,9 +848,9 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
int j;
for (j = 0; j < len; j++)
if (value[j] == ',')
- data = string_cat(data, &size, &ptr, US",,", 2);
+ data = string_catn(data, &size, &ptr, US",,", 2);
else
- data = string_cat(data, &size, &ptr, value+j, 1);
+ data = string_catn(data, &size, &ptr, value+j, 1);
}
@@ -863,7 +863,7 @@ while ((rc = ldap_result(lcp->ld, msgid, 0, timeoutptr, &result)) ==
/* Closing quote at the end of the data for a named attribute. */
if (attrs_requested != 1)
- data = string_cat(data, &size, &ptr, US"\"", 1);
+ data = string_catn(data, &size, &ptr, US"\"", 1);
/* Free the values */
diff --git a/src/src/lookups/lf_quote.c b/src/src/lookups/lf_quote.c
index 60c0a760c..86cdeef28 100644
--- a/src/src/lookups/lf_quote.c
+++ b/src/src/lookups/lf_quote.c
@@ -45,21 +45,19 @@ character. */
if (value[0] == 0 || Ustrpbrk(value, " \t\n\r") != NULL || value[0] == '\"')
{
int j;
- result = string_cat(result, asize, aoffset, US"\"", 1);
+ result = string_catn(result, asize, aoffset, US"\"", 1);
for (j = 0; j < vlength; j++)
{
if (value[j] == '\"' || value[j] == '\\')
- result = string_cat(result, asize, aoffset, US"\\", 1);
- result = string_cat(result, asize, aoffset, US value+j, 1);
+ result = string_catn(result, asize, aoffset, US"\\", 1);
+ result = string_catn(result, asize, aoffset, US value+j, 1);
}
- result = string_cat(result, asize, aoffset, US"\"", 1);
+ result = string_catn(result, asize, aoffset, US"\"", 1);
}
else
- {
- result = string_cat(result, asize, aoffset, US value, vlength);
- }
+ result = string_catn(result, asize, aoffset, US value, vlength);
-return string_cat(result, asize, aoffset, US" ", 1);
+return string_catn(result, asize, aoffset, US" ", 1);
}
/* End of lf_quote.c */
diff --git a/src/src/lookups/lsearch.c b/src/src/lookups/lsearch.c
index eb70a45fa..6101d00ac 100644
--- a/src/src/lookups/lsearch.c
+++ b/src/src/lookups/lsearch.c
@@ -258,7 +258,7 @@ for (last_was_eol = TRUE;
ptr = 0;
yield = store_get(size);
if (*s != 0)
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
/* Now handle continuations */
@@ -294,7 +294,7 @@ for (last_was_eol = TRUE;
/* Join a physical or logical line continuation onto the result string. */
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s));
+ yield = string_cat(yield, &size, &ptr, s);
}
yield[ptr] = 0;
diff --git a/src/src/lookups/mysql.c b/src/src/lookups/mysql.c
index 68b04dcc8..632541a61 100644
--- a/src/src/lookups/mysql.c
+++ b/src/src/lookups/mysql.c
@@ -266,12 +266,12 @@ while ((mysql_row_data = mysql_fetch_row(mysql_result)) != NULL)
unsigned long *lengths = mysql_fetch_lengths(mysql_result);
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
if (num_fields == 1)
{
if (mysql_row_data[0] != NULL) /* NULL value yields nothing */
- result = string_cat(result, &ssize, &offset, US mysql_row_data[0],
+ result = string_catn(result, &ssize, &offset, US mysql_row_data[0],
lengths[0]);
}
diff --git a/src/src/lookups/nisplus.c b/src/src/lookups/nisplus.c
index 00f30193c..ff632a1ca 100644
--- a/src/src/lookups/nisplus.c
+++ b/src/src/lookups/nisplus.c
@@ -156,27 +156,26 @@ for (i = 0; i < eo->en_cols.en_cols_len; i++)
if (field_name == NULL)
{
- yield = string_cat(yield, &ssize, &offset,US tc->tc_name,
- Ustrlen(tc->tc_name));
- yield = string_cat(yield, &ssize, &offset, US"=", 1);
+ yield = string_cat(yield, &ssize, &offset,US tc->tc_name);
+ yield = string_catn(yield, &ssize, &offset, US"=", 1);
/* Quote the value if it contains spaces or is empty */
if (value[0] == 0 || Ustrchr(value, ' ') != NULL)
{
int j;
- yield = string_cat(yield, &ssize, &offset, US"\"", 1);
+ yield = string_catn(yield, &ssize, &offset, US"\"", 1);
for (j = 0; j < len; j++)
{
if (value[j] == '\"' || value[j] == '\\')
- yield = string_cat(yield, &ssize, &offset, US"\\", 1);
- yield = string_cat(yield, &ssize, &offset, value+j, 1);
+ yield = string_catn(yield, &ssize, &offset, US"\\", 1);
+ yield = string_catn(yield, &ssize, &offset, value+j, 1);
}
- yield = string_cat(yield, &ssize, &offset, US"\"", 1);
+ yield = string_catn(yield, &ssize, &offset, US"\"", 1);
}
- else yield = string_cat(yield, &ssize, &offset, value, len);
+ else yield = string_catn(yield, &ssize, &offset, value, len);
- yield = string_cat(yield, &ssize, &offset, US" ", 1);
+ yield = string_catn(yield, &ssize, &offset, US" ", 1);
}
/* When the specified field is found, grab its data and finish */
diff --git a/src/src/lookups/oracle.c b/src/src/lookups/oracle.c
index 33d223436..d3fba5e4c 100644
--- a/src/src/lookups/oracle.c
+++ b/src/src/lookups/oracle.c
@@ -400,12 +400,12 @@ while (cda->rc != NO_DATA_FOUND) /* Loop for each row */
ofetch(cda);
if(cda->rc == NO_DATA_FOUND) break;
- if (result != NULL) result = string_cat(result, &ssize, &offset, "\n", 1);
+ if (result) result = string_catn(result, &ssize, &offset, "\n", 1);
/* Single field - just add on the data */
if (num_fields == 1)
- result = string_cat(result, &ssize, &offset, def[0].buf, def[0].col_retlen);
+ result = string_catn(result, &ssize, &offset, def[0].buf, def[0].col_retlen);
/* Multiple fields - precede by file name, removing {lead,trail}ing WS */
@@ -417,8 +417,8 @@ while (cda->rc != NO_DATA_FOUND) /* Loop for each row */
while (*s != 0 && isspace(*s)) s++;
slen = Ustrlen(s);
while (slen > 0 && isspace(s[slen-1])) slen--;
- result = string_cat(result, &ssize, &offset, s, slen);
- result = string_cat(result, &ssize, &offset, US"=", 1);
+ result = string_catn(result, &ssize, &offset, s, slen);
+ result = string_catn(result, &ssize, &offset, US"=", 1);
/* int and float type wont ever need escaping. Otherwise, quote the value
if it contains spaces or is empty. */
@@ -427,30 +427,30 @@ while (cda->rc != NO_DATA_FOUND) /* Loop for each row */
(def[i].buf[0] == 0 || strchr(def[i].buf, ' ') != NULL))
{
int j;
- result = string_cat(result, &ssize, &offset, "\"", 1);
+ result = string_catn(result, &ssize, &offset, "\"", 1);
for (j = 0; j < def[i].col_retlen; j++)
{
if (def[i].buf[j] == '\"' || def[i].buf[j] == '\\')
- result = string_cat(result, &ssize, &offset, "\\", 1);
- result = string_cat(result, &ssize, &offset, def[i].buf+j, 1);
+ result = string_catn(result, &ssize, &offset, "\\", 1);
+ result = string_catn(result, &ssize, &offset, def[i].buf+j, 1);
}
- result = string_cat(result, &ssize, &offset, "\"", 1);
+ result = string_catn(result, &ssize, &offset, "\"", 1);
}
else switch(desc[i].dbtype)
{
case INT_TYPE:
sprintf(CS tmp, "%d", def[i].int_buf);
- result = string_cat(result, &ssize, &offset, tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, tmp);
break;
case FLOAT_TYPE:
sprintf(CS tmp, "%f", def[i].flt_buf);
- result = string_cat(result, &ssize, &offset, tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, tmp);
break;
case STRING_TYPE:
- result = string_cat(result, &ssize, &offset, def[i].buf,
+ result = string_catn(result, &ssize, &offset, def[i].buf,
def[i].col_retlen);
break;
@@ -461,7 +461,7 @@ while (cda->rc != NO_DATA_FOUND) /* Loop for each row */
goto ORACLE_EXIT;
}
- result = string_cat(result, &ssize, &offset, " ", 1);
+ result = string_catn(result, &ssize, &offset, " ", 1);
}
}
diff --git a/src/src/lookups/pgsql.c b/src/src/lookups/pgsql.c
index 01c5375bc..53d17d7ad 100644
--- a/src/src/lookups/pgsql.c
+++ b/src/src/lookups/pgsql.c
@@ -327,11 +327,11 @@ row, we insert '\n' between them. */
for (i = 0; i < num_tuples; i++)
{
if (result != NULL)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
if (num_fields == 1)
{
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US PQgetvalue(pg_result, i, 0), PQgetlength(pg_result, i, 0));
}
diff --git a/src/src/lookups/redis.c b/src/src/lookups/redis.c
index 854d4162a..df4cf0ca6 100644
--- a/src/src/lookups/redis.c
+++ b/src/src/lookups/redis.c
@@ -219,7 +219,7 @@ if(sdata[1])
{
for (argv[i] = NULL, siz = ptr = 0; (c = *s) && !isspace(c); s++)
if (c != '\\' || *++s) /* backslash protects next char */
- argv[i] = string_cat(argv[i], &siz, &ptr, s, 1);
+ argv[i] = string_catn(argv[i], &siz, &ptr, s, 1);
*(argv[i]+ptr) = '\0';
DEBUG(D_lookup) debug_printf("REDIS: argv[%d] '%s'\n", i, argv[i]);
while (isspace(*s)) s++;
@@ -256,12 +256,12 @@ switch (redis_reply->type)
case REDIS_REPLY_INTEGER:
ttmp = (redis_reply->integer != 0) ? US"true" : US"false";
- result = string_cat(result, &ssize, &offset, US ttmp, Ustrlen(ttmp));
+ result = string_cat(result, &ssize, &offset, US ttmp);
break;
case REDIS_REPLY_STRING:
case REDIS_REPLY_STATUS:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US redis_reply->str, redis_reply->len);
break;
@@ -275,16 +275,16 @@ switch (redis_reply->type)
entry = redis_reply->element[i];
if (result)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
switch (entry->type)
{
case REDIS_REPLY_INTEGER:
tmp = string_sprintf("%d", entry->integer);
- result = string_cat(result, &ssize, &offset, US tmp, Ustrlen(tmp));
+ result = string_cat(result, &ssize, &offset, US tmp);
break;
case REDIS_REPLY_STRING:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US entry->str, entry->len);
break;
case REDIS_REPLY_ARRAY:
@@ -293,17 +293,16 @@ switch (redis_reply->type)
tentry = entry->element[j];
if (result)
- result = string_cat(result, &ssize, &offset, US"\n", 1);
+ result = string_catn(result, &ssize, &offset, US"\n", 1);
switch (tentry->type)
{
case REDIS_REPLY_INTEGER:
ttmp = string_sprintf("%d", tentry->integer);
- result = string_cat(result, &ssize, &offset,
- US ttmp, Ustrlen(ttmp));
+ result = string_cat(result, &ssize, &offset, US ttmp);
break;
case REDIS_REPLY_STRING:
- result = string_cat(result, &ssize, &offset,
+ result = string_catn(result, &ssize, &offset,
US tentry->str, tentry->len);
break;
case REDIS_REPLY_ARRAY:
diff --git a/src/src/lookups/sqlite.c b/src/src/lookups/sqlite.c
index e2330f920..6e7b015bc 100644
--- a/src/src/lookups/sqlite.c
+++ b/src/src/lookups/sqlite.c
@@ -55,7 +55,7 @@ int i;
/* For second and subsequent results, insert \n */
if (res->string != NULL)
- res->string = string_cat(res->string, &res->size, &res->len, US"\n", 1);
+ res->string = string_catn(res->string, &res->size, &res->len, US"\n", 1);
if (argc > 1)
{
diff --git a/src/src/mime.c b/src/src/mime.c
index 089ee9954..0339295f3 100644
--- a/src/src/mime.c
+++ b/src/src/mime.c
@@ -465,11 +465,11 @@ while (*s && *s != ';') /* ; terminates */
{
s++; /* skip opening " */
while (*s && *s != '"') /* " protects ; */
- val = string_cat(val, &size, &ptr, s++, 1);
+ val = string_catn(val, &size, &ptr, s++, 1);
if (*s) s++; /* skip closing " */
}
else
- val = string_cat(val, &size, &ptr, s++, 1);
+ val = string_catn(val, &size, &ptr, s++, 1);
if (val) val[ptr] = '\0';
*sp = s;
return val;
@@ -496,24 +496,24 @@ static uschar *
rfc2231_to_2047(const uschar * fname, const uschar * charset, int * len)
{
int size = 0, ptr = 0;
-uschar * val = string_cat(NULL, &size, &ptr, US"=?", 2);
+uschar * val = string_catn(NULL, &size, &ptr, US"=?", 2);
uschar c;
if (charset)
- val = string_cat(val, &size, &ptr, charset, Ustrlen(charset));
-val = string_cat(val, &size, &ptr, US"?Q?", 3);
+ val = string_cat(val, &size, &ptr, charset);
+val = string_catn(val, &size, &ptr, US"?Q?", 3);
while ((c = *fname))
if (c == '%' && isxdigit(fname[1]) && isxdigit(fname[2]))
{
- val = string_cat(val, &size, &ptr, US"=", 1);
- val = string_cat(val, &size, &ptr, ++fname, 2);
+ val = string_catn(val, &size, &ptr, US"=", 1);
+ val = string_catn(val, &size, &ptr, ++fname, 2);
fname += 2;
}
else
- val = string_cat(val, &size, &ptr, fname++, 1);
+ val = string_catn(val, &size, &ptr, fname++, 1);
-val = string_cat(val, &size, &ptr, US"?=", 2);
+val = string_catn(val, &size, &ptr, US"?=", 2);
val[*len = ptr] = '\0';
return val;
}
diff --git a/src/src/pdkim/pdkim.c b/src/src/pdkim/pdkim.c
index 12423a71b..f3959cdc7 100644
--- a/src/src/pdkim/pdkim.c
+++ b/src/src/pdkim/pdkim.c
@@ -436,7 +436,7 @@ for (p = raw_hdr; ; p++)
if (where == PDKIM_HDR_TAG)
{
if (c >= 'a' && c <= 'z')
- cur_tag = string_cat(cur_tag, &ts, &tl, p, 1);
+ cur_tag = string_catn(cur_tag, &ts, &tl, p, 1);
if (c == '=')
{
@@ -531,7 +531,7 @@ for (p = raw_hdr; ; p++)
where = PDKIM_HDR_LIMBO;
}
else
- cur_val = string_cat(cur_val, &vs, &vl, p, 1);
+ cur_val = string_catn(cur_val, &vs, &vl, p, 1);
}
NEXT_CHAR:
@@ -601,7 +601,7 @@ for (p = raw_record; ; p++)
if (where == PDKIM_HDR_TAG)
{
if (c >= 'a' && c <= 'z')
- cur_tag = string_cat(cur_tag, &ts, &tl, p, 1);
+ cur_tag = string_catn(cur_tag, &ts, &tl, p, 1);
if (c == '=')
{
@@ -655,7 +655,7 @@ for (p = raw_record; ; p++)
where = PDKIM_HDR_LIMBO;
}
else
- cur_val = string_cat(cur_val, &vs, &vl, p, 1);
+ cur_val = string_catn(cur_val, &vs, &vl, p, 1);
}
NEXT_CHAR:
@@ -1018,7 +1018,7 @@ for (p = 0; p<len; p++)
}
if (ctx->cur_header_len < PDKIM_MAX_HEADER_LEN)
- ctx->cur_header = string_cat(ctx->cur_header, &ctx->cur_header_size,
+ ctx->cur_header = string_catn(ctx->cur_header, &ctx->cur_header_size,
&ctx->cur_header_len, &data[p], 1);
}
}
@@ -1032,7 +1032,7 @@ static uschar *
pdkim_hdr_cont(uschar * str, int * size, int * ptr, int * col)
{
*col = 1;
-return string_cat(str, size, ptr, US"\r\n\t", 3);
+return string_catn(str, size, ptr, US"\r\n\t", 3);
}
@@ -1072,7 +1072,7 @@ if (pad)
l = Ustrlen(pad);
if (*col + l > 78)
str = pdkim_hdr_cont(str, size, ptr, col);
- str = string_cat(str, size, ptr, pad, l);
+ str = string_catn(str, size, ptr, pad, l);
*col += l;
}
@@ -1090,7 +1090,7 @@ while (l>77)
{ /* this fragment will not fit on a single line */
if (pad)
{
- str = string_cat(str, size, ptr, US" ", 1);
+ str = string_catn(str, size, ptr, US" ", 1);
*col += 1;
pad = NULL; /* only want this once */
l--;
@@ -1100,7 +1100,7 @@ while (l>77)
{
size_t sl = Ustrlen(intro);
- str = string_cat(str, size, ptr, intro, sl);
+ str = string_catn(str, size, ptr, intro, sl);
*col += sl;
l -= sl;
intro = NULL; /* only want this once */
@@ -1111,7 +1111,7 @@ while (l>77)
size_t sl = Ustrlen(payload);
size_t chomp = *col+sl < 77 ? sl : 78-*col;
- str = string_cat(str, size, ptr, payload, chomp);
+ str = string_catn(str, size, ptr, payload, chomp);
*col += chomp;
payload += chomp;
l -= chomp-1;
@@ -1129,7 +1129,7 @@ if (*col + l > 78)
if (pad)
{
- str = string_cat(str, size, ptr, US" ", 1);
+ str = string_catn(str, size, ptr, US" ", 1);
*col += 1;
pad = NULL;
}
@@ -1138,7 +1138,7 @@ if (intro)
{
size_t sl = Ustrlen(intro);
- str = string_cat(str, size, ptr, intro, sl);
+ str = string_catn(str, size, ptr, intro, sl);
*col += sl;
l -= sl;
intro = NULL;
@@ -1148,7 +1148,7 @@ if (payload)
{
size_t sl = Ustrlen(payload);
- str = string_cat(str, size, ptr, payload, sl);
+ str = string_catn(str, size, ptr, payload, sl);
*col += sl;
}
@@ -1167,15 +1167,15 @@ int col = 0;
uschar * hdr; int hdr_size = 0, hdr_len = 0;
uschar * canon_all; int can_size = 0, can_len = 0;
-canon_all = string_cat(NULL, &can_size, &can_len,
- pdkim_canons[sig->canon_headers], -1);
-canon_all = string_cat(canon_all, &can_size, &can_len, US"/", 1);
-canon_all = string_cat(canon_all, &can_size, &can_len,
- pdkim_canons[sig->canon_body], -1);
+canon_all = string_cat (NULL, &can_size, &can_len,
+ pdkim_canons[sig->canon_headers]);
+canon_all = string_catn(canon_all, &can_size, &can_len, US"/", 1);
+canon_all = string_cat (canon_all, &can_size, &can_len,
+ pdkim_canons[sig->canon_body]);
canon_all[can_len] = '\0';
hdr = string_cat(NULL, &hdr_size, &hdr_len,
- "DKIM-Signature: v="PDKIM_SIGNATURE_VERSION, -1);
+ "DKIM-Signature: v="PDKIM_SIGNATURE_VERSION);
col = hdr_len;
/* Required and static bits */
@@ -1321,7 +1321,7 @@ while (sig)
/* Collect header names (Note: colon presence is guaranteed here) */
uschar * q = Ustrchr(p->value, ':');
- headernames = string_cat(headernames, &hs, &hl,
+ headernames = string_catn(headernames, &hs, &hl,
p->value, (q - US p->value) + (p->next ? 1 : 0));
rh = sig->canon_headers == PDKIM_CANON_RELAXED
@@ -1342,9 +1342,9 @@ while (sig)
if (*s != '_')
{ /*SSS string_append_listele() */
if (hl > 0 && headernames[hl-1] != ':')
- headernames = string_cat(headernames, &hs, &hl, US":", 1);
+ headernames = string_catn(headernames, &hs, &hl, US":", 1);
- headernames = string_cat(headernames, &hs, &hl, s, -1);
+ headernames = string_cat(headernames, &hs, &hl, s);
}
headernames[hl] = '\0';
diff --git a/src/src/perl.c b/src/src/perl.c
index fbe9ee842..92218a6ef 100644
--- a/src/src/perl.c
+++ b/src/src/perl.c
@@ -186,7 +186,7 @@ call_perl_cat(uschar *yield, int *sizep, int *ptrp, uschar **errstrp,
return NULL;
}
str = US SvPV(sv, len);
- yield = string_cat(yield, sizep, ptrp, str, (int)len);
+ yield = string_catn(yield, sizep, ptrp, str, (int)len);
FREETMPS;
LEAVE;
diff --git a/src/src/receive.c b/src/src/receive.c
index e2a3c8aa4..2628570d8 100644
--- a/src/src/receive.c
+++ b/src/src/receive.c
@@ -1132,7 +1132,7 @@ if (sender_fullhost != NULL)
{
uschar *ss = string_sprintf(" I=[%s]:%d", interface_address,
interface_port);
- s = string_cat(s, sizeptr, ptrptr, ss, Ustrlen(ss));
+ s = string_cat(s, sizeptr, ptrptr, ss);
}
}
if (sender_ident != NULL)
@@ -3946,7 +3946,7 @@ if (smtp_input && sender_host_address != NULL && !sender_host_notsocket &&
/* Re-use the log line workspace */
sptr = 0;
- s = string_cat(s, &size, &sptr, msg, Ustrlen(msg));
+ s = string_cat(s, &size, &sptr, msg);
s = add_host_info_for_log(s, &size, &sptr);
s[sptr] = 0;
log_write(0, LOG_MAIN, "%s", s);
diff --git a/src/src/rfc2047.c b/src/src/rfc2047.c
index 1a2e9c758..5c987e292 100644
--- a/src/src/rfc2047.c
+++ b/src/src/rfc2047.c
@@ -218,7 +218,7 @@ while (mimeword != NULL)
#endif
if (mimeword != string)
- yield = string_cat(yield, &size, &ptr, string, mimeword - string);
+ yield = string_catn(yield, &size, &ptr, string, mimeword - string);
/* Do a charset translation if required. This is supported only on hosts
that have the iconv() function. Translation errors set error, but carry on,
@@ -305,7 +305,7 @@ while (mimeword != NULL)
/* Add the new string onto the result */
- yield = string_cat(yield, &size, &ptr, tptr, tlen);
+ yield = string_catn(yield, &size, &ptr, tptr, tlen);
}
#if HAVE_ICONV
@@ -328,7 +328,7 @@ while (mimeword != NULL)
/* Copy the remaining characters of the string, zero-terminate it, and return
the length as well if requested. */
-yield = string_cat(yield, &size, &ptr, string, Ustrlen(string));
+yield = string_cat(yield, &size, &ptr, string);
yield[ptr] = 0;
if (lenptr != NULL) *lenptr = ptr;
if (sizeptr != NULL) *sizeptr = size;
diff --git a/src/src/sieve.c b/src/src/sieve.c
index 5d072f855..c53db3732 100644
--- a/src/src/sieve.c
+++ b/src/src/sieve.c
@@ -433,7 +433,7 @@ if (*uri && *uri!='?')
capacity=0;
to.character= NULL;
to.length=0;
- to.character=string_cat(to.character,&capacity,&to.length,start,uri-start);
+ to.character=string_catn(to.character, &capacity, &to.length, start, uri-start);
to.character[to.length]='\0';
if (uri_decode(&to)==-1)
{
@@ -467,7 +467,7 @@ if (*uri=='?')
capacity=0;
hname.character= NULL;
hname.length=0;
- hname.character=string_cat(hname.character,&capacity,&hname.length,start,uri-start);
+ hname.character = string_catn(hname.character, &capacity, &hname.length, start, uri-start);
hname.character[hname.length]='\0';
if (uri_decode(&hname)==-1)
{
@@ -490,7 +490,7 @@ if (*uri=='?')
capacity=0;
hvalue.character= NULL;
hvalue.length=0;
- hvalue.character=string_cat(hvalue.character,&capacity,&hvalue.length,start,uri-start);
+ hvalue.character=string_catn(hvalue.character,&capacity,&hvalue.length,start,uri-start);
hvalue.character[hvalue.length]='\0';
if (uri_decode(&hvalue)==-1)
{
@@ -529,10 +529,10 @@ if (*uri=='?')
{
if (header->length==-1) header->length=0;
capacity=header->length;
- header->character=string_cat(header->character,&capacity,&header->length,hname.character,hname.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS ": ",2);
- header->character=string_cat(header->character,&capacity,&header->length,hvalue.character,hvalue.length);
- header->character=string_cat(header->character,&capacity,&header->length,CUS "\n",1);
+ header->character=string_catn(header->character,&capacity,&header->length,hname.character,hname.length);
+ header->character=string_catn(header->character,&capacity,&header->length,CUS ": ",2);
+ header->character=string_catn(header->character,&capacity,&header->length,hvalue.character,hvalue.length);
+ header->character=string_catn(header->character,&capacity,&header->length,CUS "\n",1);
header->character[header->length]='\0';
}
}
@@ -1006,24 +1006,24 @@ while (l)
{
case '\0':
{
- quoted=string_cat(quoted,&size,&ptr,CUS "\\0",2);
+ quoted=string_catn(quoted,&size,&ptr,CUS "\\0",2);
break;
}
case '$':
case '{':
case '}':
{
- quoted=string_cat(quoted,&size,&ptr,CUS "\\",1);
+ quoted=string_catn(quoted,&size,&ptr,CUS "\\",1);
}
default:
{
- quoted=string_cat(quoted,&size,&ptr,h,1);
+ quoted=string_catn(quoted,&size,&ptr,h,1);
}
}
++h;
--l;
}
-quoted=string_cat(quoted,&size,&ptr,CUS "",1);
+quoted=string_catn(quoted,&size,&ptr,CUS "",1);
return quoted;
}
@@ -1487,7 +1487,7 @@ if (*filter->pc=='"') /* quoted string */
++filter->pc;
/* that way, there will be at least one character allocated */
- data->character=string_cat(data->character,&dataCapacity,&foo,CUS "",1);
+ data->character=string_catn(data->character,&dataCapacity,&foo,CUS "",1);
#ifdef ENCODED_CHARACTER
if (filter->require_encoded_character
&& string_decode(filter,data)==-1)
@@ -1497,7 +1497,7 @@ if (*filter->pc=='"') /* quoted string */
}
else if (*filter->pc=='\\' && *(filter->pc+1)) /* quoted character */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc+1,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc+1,1);
filter->pc+=2;
}
else /* regular character */
@@ -1507,11 +1507,11 @@ if (*filter->pc=='"') /* quoted string */
#else
if (*filter->pc=='\n')
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,US"\r",1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,US"\r",1);
++filter->line;
}
#endif
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc,1);
filter->pc++;
}
}
@@ -1553,7 +1553,7 @@ else if (Ustrncmp(filter->pc,CUS "text:",5)==0) /* multiline string */
if (*filter->pc=='\n') /* end of line */
#endif
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,CUS "\r\n",2);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,CUS "\r\n",2);
#ifdef RFC_EOL
filter->pc+=2;
#else
@@ -1569,7 +1569,7 @@ else if (Ustrncmp(filter->pc,CUS "text:",5)==0) /* multiline string */
int foo=data->length;
/* that way, there will be at least one character allocated */
- data->character=string_cat(data->character,&dataCapacity,&foo,CUS "",1);
+ data->character=string_catn(data->character,&dataCapacity,&foo,CUS "",1);
#ifdef RFC_EOL
filter->pc+=3;
#else
@@ -1585,13 +1585,13 @@ else if (Ustrncmp(filter->pc,CUS "text:",5)==0) /* multiline string */
}
else if (*filter->pc=='.' && *(filter->pc+1)=='.') /* remove dot stuffing */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,CUS ".",1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,CUS ".",1);
filter->pc+=2;
}
}
else /* regular character */
{
- data->character=string_cat(data->character,&dataCapacity,&data->length,filter->pc,1);
+ data->character=string_catn(data->character,&dataCapacity,&data->length,filter->pc,1);
filter->pc++;
}
}
@@ -3297,10 +3297,10 @@ while (*filter->pc)
capacity=0;
if (handle.length==-1)
{
- if (subject.length!=-1) key.character=string_cat(key.character,&capacity,&key.length,subject.character,subject.length);
- if (from.length!=-1) key.character=string_cat(key.character,&capacity,&key.length,from.character,from.length);
- key.character=string_cat(key.character,&capacity,&key.length,reason_is_mime?US"1":US"0",1);
- key.character=string_cat(key.character,&capacity,&key.length,reason.character,reason.length);
+ if (subject.length!=-1) key.character=string_catn(key.character,&capacity,&key.length,subject.character,subject.length);
+ if (from.length!=-1) key.character=string_catn(key.character,&capacity,&key.length,from.character,from.length);
+ key.character=string_catn(key.character,&capacity,&key.length,reason_is_mime?US"1":US"0",1);
+ key.character=string_catn(key.character,&capacity,&key.length,reason.character,reason.length);
}
else
key=handle;
@@ -3315,8 +3315,8 @@ while (*filter->pc)
{
capacity=Ustrlen(filter->vacation_directory);
start=capacity;
- once=string_cat(filter->vacation_directory,&capacity,&start,US"/",1);
- once=string_cat(once,&capacity,&start,hexdigest,33);
+ once=string_catn(filter->vacation_directory,&capacity,&start,US"/",1);
+ once=string_catn(once,&capacity,&start,hexdigest,33);
once[start] = '\0';
/* process subject */
@@ -3331,7 +3331,7 @@ while (*filter->pc)
expand_header(&subject,&str_subject);
capacity=6;
start=6;
- subject.character=string_cat(US"Auto: ",&capacity,&start,subject.character,subject.length);
+ subject.character=string_catn(US"Auto: ",&capacity,&start,subject.character,subject.length);
subject.length=start;
}
else
@@ -3378,13 +3378,13 @@ while (*filter->pc)
);
capacity = 0;
start = 0;
- addr->reply->headers = string_cat(NULL,&capacity,&start,reason.character,mime_body-reason.character);
+ addr->reply->headers = string_catn(NULL,&capacity,&start,reason.character,mime_body-reason.character);
addr->reply->headers[start] = '\0';
capacity = 0;
start = 0;
if (mime_body+(sizeof(nlnl)-1)<reason_end) mime_body+=(sizeof(nlnl)-1);
else mime_body=reason_end-1;
- addr->reply->text = string_cat(NULL,&capacity,&start,mime_body,reason_end-mime_body);
+ addr->reply->text = string_catn(NULL,&capacity,&start,mime_body,reason_end-mime_body);
addr->reply->text[start] = '\0';
}
else
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 86d566dc9..1398e620b 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -2394,20 +2394,20 @@ do /* At least once, in case we have an empty string */
{
int len;
uschar *linebreak = Ustrchr(p, '\n');
- ss = string_cat(ss, &size, &ptr, code, 3);
+ ss = string_catn(ss, &size, &ptr, code, 3);
if (linebreak == NULL)
{
len = Ustrlen(p);
- ss = string_cat(ss, &size, &ptr, US" ", 1);
+ ss = string_catn(ss, &size, &ptr, US" ", 1);
}
else
{
len = linebreak - p;
- ss = string_cat(ss, &size, &ptr, US"-", 1);
+ ss = string_catn(ss, &size, &ptr, US"-", 1);
}
- ss = string_cat(ss, &size, &ptr, esc, esclen);
- ss = string_cat(ss, &size, &ptr, p, len);
- ss = string_cat(ss, &size, &ptr, US"\r\n", 2);
+ ss = string_catn(ss, &size, &ptr, esc, esclen);
+ ss = string_catn(ss, &size, &ptr, p, len);
+ ss = string_catn(ss, &size, &ptr, US"\r\n", 2);
p += len;
if (linebreak != NULL) p++;
}
@@ -3592,10 +3592,9 @@ while (done <= 0)
if (sender_host_address != NULL)
{
- s = string_cat(s, &size, &ptr, US" [", 2);
- s = string_cat(s, &size, &ptr, sender_host_address,
- Ustrlen(sender_host_address));
- s = string_cat(s, &size, &ptr, US"]", 1);
+ s = string_catn(s, &size, &ptr, US" [", 2);
+ s = string_cat (s, &size, &ptr, sender_host_address);
+ s = string_catn(s, &size, &ptr, US"]", 1);
}
}
@@ -3619,7 +3618,7 @@ while (done <= 0)
size = ptr + 1;
}
- s = string_cat(s, &size, &ptr, US"\r\n", 2);
+ s = string_catn(s, &size, &ptr, US"\r\n", 2);
/* If we received EHLO, we must create a multiline response which includes
the functions supported. */
@@ -3638,12 +3637,12 @@ while (done <= 0)
{
sprintf(CS big_buffer, "%.3s-SIZE %d\r\n", smtp_code,
thismessage_size_limit);
- s = string_cat(s, &size, &ptr, big_buffer, Ustrlen(big_buffer));
+ s = string_cat(s, &size, &ptr, big_buffer);
}
else
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-SIZE\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-SIZE\r\n", 7);
}
/* Exim does not do protocol conversion or data conversion. It is 8-bit
@@ -3655,15 +3654,15 @@ while (done <= 0)
if (accept_8bitmime)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-8BITMIME\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-8BITMIME\r\n", 11);
}
/* Advertise DSN support if configured to do so. */
if (verify_check_host(&dsn_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-DSN\r\n", 6);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-DSN\r\n", 6);
dsn_advertised = TRUE;
}
@@ -3672,8 +3671,8 @@ while (done <= 0)
if (acl_smtp_etrn != NULL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-ETRN\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-ETRN\r\n", 7);
}
/* Advertise EXPN if there's an ACL checking whether a host is
@@ -3681,8 +3680,8 @@ while (done <= 0)
if (acl_smtp_expn != NULL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-EXPN\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-EXPN\r\n", 7);
}
/* Exim is quite happy with pipelining, so let the other end know that
@@ -3691,8 +3690,8 @@ while (done <= 0)
if (pipelining_enable &&
verify_check_host(&pipelining_advertise_hosts) == OK)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-PIPELINING\r\n", 13);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-PIPELINING\r\n", 13);
sync_cmd_limit = NON_SYNC_CMD_PIPELINING;
pipelining_advertised = TRUE;
}
@@ -3725,22 +3724,21 @@ while (done <= 0)
int saveptr;
if (first)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-AUTH", 5);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-AUTH", 5);
first = FALSE;
auth_advertised = TRUE;
}
saveptr = ptr;
- s = string_cat(s, &size, &ptr, US" ", 1);
- s = string_cat(s, &size, &ptr, au->public_name,
- Ustrlen(au->public_name));
+ s = string_catn(s, &size, &ptr, US" ", 1);
+ s = string_cat (s, &size, &ptr, au->public_name);
while (++saveptr < ptr) s[saveptr] = toupper(s[saveptr]);
au->advertised = TRUE;
}
else
au->advertised = FALSE;
- if (!first) s = string_cat(s, &size, &ptr, US"\r\n", 2);
+ if (!first) s = string_catn(s, &size, &ptr, US"\r\n", 2);
}
/* Advertise TLS (Transport Level Security) aka SSL (Secure Socket Layer)
@@ -3752,8 +3750,8 @@ while (done <= 0)
if (tls_in.active < 0 &&
verify_check_host(&tls_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-STARTTLS\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-STARTTLS\r\n", 11);
tls_advertised = TRUE;
}
#endif
@@ -3762,8 +3760,8 @@ while (done <= 0)
/* Per Recipient Data Response, draft by Eric A. Hall extending RFC */
if (prdr_enable)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-PRDR\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-PRDR\r\n", 7);
}
#endif
@@ -3771,16 +3769,16 @@ while (done <= 0)
if ( accept_8bitmime
&& verify_check_host(&smtputf8_advertise_hosts) != FAIL)
{
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US"-SMTPUTF8\r\n", 11);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US"-SMTPUTF8\r\n", 11);
smtputf8_advertised = TRUE;
}
#endif
/* Finish off the multiline reply with one that is always available. */
- s = string_cat(s, &size, &ptr, smtp_code, 3);
- s = string_cat(s, &size, &ptr, US" HELP\r\n", 7);
+ s = string_catn(s, &size, &ptr, smtp_code, 3);
+ s = string_catn(s, &size, &ptr, US" HELP\r\n", 7);
}
/* Terminate the string (for debug), write it, and note that HELO/EHLO
diff --git a/src/src/string.c b/src/src/string.c
index a53dff270..963948f77 100644
--- a/src/src/string.c
+++ b/src/src/string.c
@@ -952,7 +952,7 @@ else
for (;;)
{
for (ss = s + 1; *ss != 0 && *ss != sep; ss++);
- buffer = string_cat(buffer, &size, &ptr, s, ss-s);
+ buffer = string_catn(buffer, &size, &ptr, s, ss-s);
s = ss;
if (*s == 0 || *(++s) != sep || sep_is_special) break;
}
@@ -995,17 +995,17 @@ uschar * sp;
if (list)
{
- new = string_cat(new, &sz, &off, list, Ustrlen(list));
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_cat (new, &sz, &off, list);
+ new = string_catn(new, &sz, &off, &sep, 1);
}
while((sp = Ustrchr(ele, sep)))
{
- new = string_cat(new, &sz, &off, ele, sp-ele+1);
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_catn(new, &sz, &off, ele, sp-ele+1);
+ new = string_catn(new, &sz, &off, &sep, 1);
ele = sp+1;
}
-new = string_cat(new, &sz, &off, ele, Ustrlen(ele));
+new = string_cat(new, &sz, &off, ele);
new[off] = '\0';
return new;
}
@@ -1039,18 +1039,18 @@ const uschar * sp;
if (list)
{
- new = string_cat(new, &sz, &off, list, Ustrlen(list));
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_cat (new, &sz, &off, list);
+ new = string_catn(new, &sz, &off, &sep, 1);
}
while((sp = Ustrnchr(ele, sep, &len)))
{
- new = string_cat(new, &sz, &off, ele, sp-ele+1);
- new = string_cat(new, &sz, &off, &sep, 1);
+ new = string_catn(new, &sz, &off, ele, sp-ele+1);
+ new = string_catn(new, &sz, &off, &sep, 1);
ele = sp+1;
len--;
}
-new = string_cat(new, &sz, &off, ele, len);
+new = string_catn(new, &sz, &off, ele, len);
new[off] = '\0';
return new;
}
@@ -1091,12 +1091,10 @@ Returns: pointer to the start of the string, changed if copied for expansion.
/* coverity[+alloc] */
uschar *
-string_cat(uschar *string, int *size, int *ptr, const uschar *s, int count)
+string_catn(uschar *string, int *size, int *ptr, const uschar *s, int count)
{
int p = *ptr;
-if (count == -1) count = Ustrlen(s);
-
if (p + count >= *size)
{
int oldsize = *size;
@@ -1148,6 +1146,13 @@ memcpy(string + p, s, count);
*ptr = p + count;
return string;
}
+
+
+uschar *
+string_cat(uschar *string, int *size, int *ptr, const uschar *s)
+{
+return string_catn(string, size, ptr, s, Ustrlen(s));
+}
#endif /* COMPILE_UTILITY */
@@ -1185,7 +1190,7 @@ va_start(ap, count);
for (i = 0; i < count; i++)
{
uschar *t = va_arg(ap, uschar *);
- string = string_cat(string, size, ptr, t, Ustrlen(t));
+ string = string_cat(string, size, ptr, t);
}
va_end(ap);
@@ -1568,7 +1573,7 @@ if (testflag(addr, af_include_affixes) && s)
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+ yield = string_cat(yield, sizeptr, ptrptr, s);
}
s = addr->local_part;
@@ -1576,7 +1581,7 @@ s = addr->local_part;
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
-yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+yield = string_cat(yield, sizeptr, ptrptr, s);
s = addr->suffix;
if (testflag(addr, af_include_affixes) && s)
@@ -1585,7 +1590,7 @@ if (testflag(addr, af_include_affixes) && s)
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, sizeptr, ptrptr, s, Ustrlen(s));
+ yield = string_cat(yield, sizeptr, ptrptr, s);
}
return yield;
@@ -1636,7 +1641,7 @@ if (testflag(addr, af_pfr) ||
addr->transport != NULL && addr->transport->info->local))
{
if (testflag(addr, af_file) && addr->local_part[0] != '/')
- yield = string_cat(yield, &size, &ptr, CUS"save ", 5);
+ yield = string_catn(yield, &size, &ptr, CUS"save ", 5);
yield = string_get_localpart(addr, yield, &size, &ptr);
}
@@ -1650,18 +1655,16 @@ else
{
const uschar * s;
yield = string_get_localpart(addr, yield, &size, &ptr);
- yield = string_cat(yield, &size, &ptr, US"@", 1);
+ yield = string_catn(yield, &size, &ptr, US"@", 1);
s = addr->domain;
#ifdef SUPPORT_I18N
if (testflag(addr, af_utf8_downcvt))
s = string_localpart_utf8_to_alabel(s, NULL);
#endif
- yield = string_cat(yield, &size, &ptr, s, Ustrlen(s) );
+ yield = string_cat(yield, &size, &ptr, s);
}
else
- {
- yield = string_cat(yield, &size, &ptr, addr->address, Ustrlen(addr->address));
- }
+ yield = string_cat(yield, &size, &ptr, addr->address);
yield[ptr] = 0;
/* If the address we are going to print is the same as the top address,
@@ -1688,28 +1691,24 @@ if ((all_parents || testflag(addr, af_pfr)) &&
address_item *addr2;
for (addr2 = addr->parent; addr2 != topaddr; addr2 = addr2->parent)
{
- yield = string_cat(yield, &size, &ptr, s, 2);
- yield = string_cat(yield, &size, &ptr, addr2->address, Ustrlen(addr2->address));
+ yield = string_catn(yield, &size, &ptr, s, 2);
+ yield = string_cat (yield, &size, &ptr, addr2->address);
if (!all_parents) break;
s = US", ";
}
- yield = string_cat(yield, &size, &ptr, US")", 1);
+ yield = string_catn(yield, &size, &ptr, US")", 1);
}
/* Add the top address if it is required */
if (add_topaddr)
{
- yield = string_cat(yield, &size, &ptr, US" <", 2);
+ yield = string_catn(yield, &size, &ptr, US" <", 2);
- if (addr->onetime_parent == NULL)
- yield = string_cat(yield, &size, &ptr, topaddr->address,
- Ustrlen(topaddr->address));
- else
- yield = string_cat(yield, &size, &ptr, addr->onetime_parent,
- Ustrlen(addr->onetime_parent));
+ yield = string_cat(yield, &size, &ptr,
+ addr->onetime_parent ? addr->onetime_parent : topaddr->address);
- yield = string_cat(yield, &size, &ptr, US">", 1);
+ yield = string_catn(yield, &size, &ptr, US">", 1);
}
yield[ptr] = 0; /* string_cat() leaves space */
diff --git a/src/src/transports/pipe.c b/src/src/transports/pipe.c
index eaf04d150..5ebd64f32 100644
--- a/src/src/transports/pipe.c
+++ b/src/src/transports/pipe.c
@@ -489,11 +489,11 @@ if (expand_arguments)
for (ad = addr; ad != NULL; ad = ad->next)
{
- if (ad != addr) string_cat(s, &size, &offset, US" ", 1);
- string_cat(s, &size, &offset, ad->address, Ustrlen(ad->address));
+ if (ad != addr) string_catn(s, &size, &offset, US" ", 1);
+ string_cat(s, &size, &offset, ad->address);
}
- string_cat(s, &size, &offset, q, Ustrlen(q));
+ string_cat(s, &size, &offset, q);
s[offset] = 0;
}
@@ -1100,36 +1100,33 @@ if ((rc = child_close(pid, timeout)) != 0)
if (*ss != 0)
{
- addr->message = string_cat(addr->message, &size, &ptr, US" ", 1);
- addr->message = string_cat(addr->message, &size, &ptr,
- ss, Ustrlen(ss));
+ addr->message = string_catn(addr->message, &size, &ptr, US" ", 1);
+ addr->message = string_cat (addr->message, &size, &ptr, ss);
}
/* Now add the command and arguments */
- addr->message = string_cat(addr->message, &size, &ptr,
+ addr->message = string_catn(addr->message, &size, &ptr,
US" from command:", 14);
for (i = 0; i < sizeof(argv)/sizeof(int *) && argv[i] != NULL; i++)
{
BOOL quote = FALSE;
- addr->message = string_cat(addr->message, &size, &ptr, US" ", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US" ", 1);
if (Ustrpbrk(argv[i], " \t") != NULL)
{
quote = TRUE;
- addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1);
}
- addr->message = string_cat(addr->message, &size, &ptr, argv[i],
- Ustrlen(argv[i]));
+ addr->message = string_cat(addr->message, &size, &ptr, argv[i]);
if (quote)
- addr->message = string_cat(addr->message, &size, &ptr, US"\"", 1);
+ addr->message = string_catn(addr->message, &size, &ptr, US"\"", 1);
}
/* Add previous filter timeout message, if present. */
- if (*tmsg != 0)
- addr->message = string_cat(addr->message, &size, &ptr, tmsg,
- Ustrlen(tmsg));
+ if (*tmsg)
+ addr->message = string_cat(addr->message, &size, &ptr, tmsg);
addr->message[ptr] = 0; /* Ensure concatenated string terminated */
}