summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/src/auths/cram_md5.c5
-rw-r--r--src/src/auths/xtextencode.c10
-rw-r--r--src/src/debug.c6
-rw-r--r--src/src/dns.c5
-rw-r--r--src/src/exim.c3
-rw-r--r--src/src/host.c5
-rw-r--r--src/src/log.c3
-rw-r--r--src/src/parse.c3
-rw-r--r--src/src/queue.c26
-rw-r--r--src/src/smtp_in.c5
-rw-r--r--src/src/string.c17
-rw-r--r--src/src/tlscert-gnu.c16
-rw-r--r--src/src/tlscert-openssl.c3
13 files changed, 36 insertions, 71 deletions
diff --git a/src/src/auths/cram_md5.c b/src/src/auths/cram_md5.c
index 95f7cc543..04d893c97 100644
--- a/src/src/auths/cram_md5.c
+++ b/src/src/auths/cram_md5.c
@@ -317,10 +317,7 @@ for (p = big_buffer; *p; ) p++;
*p++ = ' ';
for (i = 0; i < 16; i++)
- {
- sprintf(CS p, "%02x", digest[i]);
- p += 2;
- }
+ p += sprintf(CS p, "%02x", digest[i]);
/* Send the response, in base 64, and check the result. The response is
in big_buffer, but b64encode() returns its result in working store,
diff --git a/src/src/auths/xtextencode.c b/src/src/auths/xtextencode.c
index 7cdfe3224..38237207e 100644
--- a/src/src/auths/xtextencode.c
+++ b/src/src/auths/xtextencode.c
@@ -45,14 +45,10 @@ pp = code = store_get(count);
p = (uschar *)clear;
c = len;
while (c-- > 0)
- {
if ((x = *p++) < 33 || x > 127 || x == '+' || x == '=')
- {
- sprintf(CS pp, "+%.02x", x); /* There's always room */
- pp += 3;
- }
- else *pp++ = x;
- }
+ pp += sprintf(CS pp, "+%.02x", x); /* There's always room */
+ else
+ *pp++ = x;
*pp = 0;
return code;
diff --git a/src/src/debug.c b/src/src/debug.c
index 35571547f..8c414d0f9 100644
--- a/src/src/debug.c
+++ b/src/src/debug.c
@@ -184,15 +184,13 @@ if (debug_ptr == debug_buffer)
{
time_t now = time(NULL);
struct tm *t = timestamps_utc? gmtime(&now) : localtime(&now);
- (void) sprintf(CS debug_ptr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min,
+ debug_ptr += sprintf(CS debug_ptr, "%02d:%02d:%02d ", t->tm_hour, t->tm_min,
t->tm_sec);
- while(*debug_ptr != 0) debug_ptr++;
}
DEBUG(D_pid)
{
- sprintf(CS debug_ptr, "%5d ", (int)getpid());
- while(*debug_ptr != 0) debug_ptr++;
+ debug_ptr += sprintf(CS debug_ptr, "%5d ", (int)getpid());
}
/* Set up prefix if outputting for host checking and not debugging */
diff --git a/src/src/dns.c b/src/src/dns.c
index e29f86c48..0408171e8 100644
--- a/src/src/dns.c
+++ b/src/src/dns.c
@@ -271,10 +271,7 @@ else
{
int j;
for (j = 0; j < 32; j += 4)
- {
- sprintf(CS pp, "%x.", (v6[i] >> j) & 15);
- pp += 2;
- }
+ pp += sprintf(CS pp, "%x.", (v6[i] >> j) & 15);
}
Ustrcpy(pp, "ip6.arpa.");
diff --git a/src/src/exim.c b/src/src/exim.c
index 37cf8bc6e..581b16190 100644
--- a/src/src/exim.c
+++ b/src/src/exim.c
@@ -4132,9 +4132,8 @@ if (((debug_selector & D_any) != 0 || LOGGING(arguments))
quote = US"";
while (*pp != 0) if (isspace(*pp++)) { quote = US"\""; break; }
}
- sprintf(CS p, " %s%.*s%s", quote, (int)(big_buffer_size -
+ p += sprintf(CS p, " %s%.*s%s", quote, (int)(big_buffer_size -
(p - big_buffer) - 4), printing, quote);
- while (*p) p++;
}
if (LOGGING(arguments))
diff --git a/src/src/host.c b/src/src/host.c
index 4cdd18b89..07d9491d4 100644
--- a/src/src/host.c
+++ b/src/src/host.c
@@ -1160,10 +1160,7 @@ tt--; /* lose final separator */
if (mask < 0)
*tt = 0;
else
- {
- sprintf(CS tt, "/%d", mask);
- while (*tt) tt++;
- }
+ tt += sprintf(CS tt, "/%d", mask);
return tt - buffer;
}
diff --git a/src/src/log.c b/src/src/log.c
index d12989b6f..fd72bb1ad 100644
--- a/src/src/log.c
+++ b/src/src/log.c
@@ -857,13 +857,12 @@ DEBUG(D_any|D_v)
}
}
- sprintf(CS ptr, "%s%s%s%s\n ",
+ ptr += sprintf(CS ptr, "%s%s%s%s\n ",
((flags & LOG_MAIN) != 0)? " MAIN" : "",
((flags & LOG_PANIC) != 0)? " PANIC" : "",
((flags & LOG_PANIC_DIE) == LOG_PANIC_DIE)? " DIE" : "",
((flags & LOG_REJECT) != 0)? " REJECT" : "");
- while(*ptr) ptr++;
if ((flags & LOG_CONFIG) != 0) ptr = log_config_info(ptr, flags);
va_start(ap, format);
diff --git a/src/src/parse.c b/src/src/parse.c
index 94a1af6ab..a7231f39b 100644
--- a/src/src/parse.c
+++ b/src/src/parse.c
@@ -913,8 +913,7 @@ for (; len > 0; len--)
}
else
{
- sprintf(CS t, "=%02X", ch);
- while (*t != 0) t++;
+ t += sprintf(CS t, "=%02X", ch);
coded = TRUE;
first_byte = !first_byte;
}
diff --git a/src/src/queue.c b/src/src/queue.c
index 7b8f727bc..5d8d610c6 100644
--- a/src/src/queue.c
+++ b/src/src/queue.c
@@ -405,28 +405,18 @@ if (!recurse)
*p = 0;
p = big_buffer;
- sprintf(CS p, "pid=%d", (int)queue_run_pid);
- while (*p != 0) p++;
+ p += sprintf(CS p, "pid=%d", (int)queue_run_pid);
if (extras[0] != 0)
- {
- sprintf(CS p, " -q%s", extras);
- while (*p != 0) p++;
- }
+ p += sprintf(CS p, " -q%s", extras);
- if (deliver_selectstring != NULL)
- {
- sprintf(CS p, " -R%s %s", deliver_selectstring_regex? "r" : "",
+ if (deliver_selectstring)
+ p += sprintf(CS p, " -R%s %s", deliver_selectstring_regex? "r" : "",
deliver_selectstring);
- while (*p != 0) p++;
- }
- if (deliver_selectstring_sender != NULL)
- {
- sprintf(CS p, " -S%s %s", deliver_selectstring_sender_regex? "r" : "",
+ if (deliver_selectstring_sender)
+ p += sprintf(CS p, " -S%s %s", deliver_selectstring_sender_regex? "r" : "",
deliver_selectstring_sender);
- while (*p != 0) p++;
- }
log_detail = string_copy(big_buffer);
if (*queue_name)
@@ -438,10 +428,10 @@ if (!recurse)
/* If deliver_selectstring is a regex, compile it. */
-if (deliver_selectstring != NULL && deliver_selectstring_regex)
+if (deliver_selectstring && deliver_selectstring_regex)
selectstring_regex = regex_must_compile(deliver_selectstring, TRUE, FALSE);
-if (deliver_selectstring_sender != NULL && deliver_selectstring_sender_regex)
+if (deliver_selectstring_sender && deliver_selectstring_sender_regex)
selectstring_regex_sender =
regex_must_compile(deliver_selectstring_sender, TRUE, FALSE);
diff --git a/src/src/smtp_in.c b/src/src/smtp_in.c
index 629634267..3d5ad863f 100644
--- a/src/src/smtp_in.c
+++ b/src/src/smtp_in.c
@@ -2619,10 +2619,7 @@ if (!sender_host_unknown)
Ustrcat(p, "[ ");
p += 2;
for (i = 0; i < opt[1]; i++)
- {
- sprintf(CS p, "%2.2x ", opt[i]);
- p += 3;
- }
+ p += sprintf(CS p, "%2.2x ", opt[i]);
*p++ = ']';
}
opt += opt[1];
diff --git a/src/src/string.c b/src/src/string.c
index 53bcdfb7b..2de595afb 100644
--- a/src/src/string.c
+++ b/src/src/string.c
@@ -1355,20 +1355,18 @@ while (*fp != 0)
switch(length)
{
case L_SHORT:
- case L_NORMAL: sprintf(CS p, newformat, va_arg(ap, int)); break;
- case L_LONG: sprintf(CS p, newformat, va_arg(ap, long int)); break;
- case L_LONGLONG: sprintf(CS p, newformat, va_arg(ap, LONGLONG_T)); break;
- case L_SIZE: sprintf(CS p, newformat, va_arg(ap, size_t)); break;
+ case L_NORMAL: p += sprintf(CS p, newformat, va_arg(ap, int)); break;
+ case L_LONG: p += sprintf(CS p, newformat, va_arg(ap, long int)); break;
+ case L_LONGLONG: p += sprintf(CS p, newformat, va_arg(ap, LONGLONG_T)); break;
+ case L_SIZE: p += sprintf(CS p, newformat, va_arg(ap, size_t)); break;
}
- while (*p) p++;
break;
case 'p':
if (p >= last - 24) { yield = FALSE; goto END_FORMAT; }
strncpy(newformat, item_start, fp - item_start);
newformat[fp - item_start] = 0;
- sprintf(CS p, newformat, va_arg(ap, void *));
- while (*p) p++;
+ p += sprintf(CS p, newformat, va_arg(ap, void *));
break;
/* %f format is inherently insecure if the numbers that it may be
@@ -1388,10 +1386,9 @@ while (*fp != 0)
strncpy(newformat, item_start, fp - item_start);
newformat[fp-item_start] = 0;
if (length == L_LONGDOUBLE)
- sprintf(CS p, newformat, va_arg(ap, long double));
+ p += sprintf(CS p, newformat, va_arg(ap, long double));
else
- sprintf(CS p, newformat, va_arg(ap, double));
- while (*p) p++;
+ p += sprintf(CS p, newformat, va_arg(ap, double));
break;
/* String types */
diff --git a/src/src/tlscert-gnu.c b/src/src/tlscert-gnu.c
index 3c6953a99..65d01214a 100644
--- a/src/src/tlscert-gnu.c
+++ b/src/src/tlscert-gnu.c
@@ -182,8 +182,8 @@ if ((ret = gnutls_x509_crt_get_serial((gnutls_x509_crt_t)cert,
bin, &sz)))
return g_err("gs0", __FUNCTION__, ret);
-for(dp = txt, sp = bin; sz; dp += 2, sp++, sz--)
- sprintf(CS dp, "%.2x", *sp);
+for(dp = txt, sp = bin; sz; sz--)
+ dp += sprintf(CS dp, "%.2x", *sp++);
for(sp = txt; sp[0]=='0' && sp[1]; ) sp++; /* leading zeroes */
return string_copy(sp);
}
@@ -205,8 +205,8 @@ cp1 = store_get(len*4+1);
if (gnutls_x509_crt_get_signature((gnutls_x509_crt_t)cert, CS cp1, &len) != 0)
return g_err("gs1", __FUNCTION__, ret);
-for(cp3 = cp2 = cp1+len; cp1 < cp2; cp3 += 3, cp1++)
- sprintf(CS cp3, "%.2x ", *cp1);
+for(cp3 = cp2 = cp1+len; cp1 < cp2; cp1++)
+ cp3 += sprintf(CS cp3, "%.2x ", *cp1);
cp3[-1]= '\0';
return cp2;
@@ -269,8 +269,8 @@ if (ret < 0)
/* binary data, DER encoded */
/* just dump for now */
-for(cp3 = cp2 = cp1+siz; cp1 < cp2; cp3 += 3, cp1++)
- sprintf(CS cp3, "%.2x ", *cp1);
+for(cp3 = cp2 = cp1+siz; cp1 < cp2; cp1++)
+ cp3 += sprintf(CS cp3, "%.2x ", *cp1);
cp3[-1]= '\0';
return cp2;
@@ -459,8 +459,8 @@ cp = store_get(siz*3+1);
if ((ret = gnutls_x509_crt_get_fingerprint(cert, algo, cp, &siz)) < 0)
return g_err("gf1", __FUNCTION__, ret);
-for (cp3 = cp2 = cp+siz; cp < cp2; cp++, cp3+=2)
- sprintf(CS cp3, "%02X",*cp);
+for (cp3 = cp2 = cp+siz; cp < cp2; cp++)
+ cp3 += sprintf(CS cp3, "%02X", *cp);
return cp2;
}
diff --git a/src/src/tlscert-openssl.c b/src/src/tlscert-openssl.c
index 2e6ee8b3c..87623a879 100644
--- a/src/src/tlscert-openssl.c
+++ b/src/src/tlscert-openssl.c
@@ -331,8 +331,7 @@ cp3 = cp2 = store_get(len*3+1);
while(len)
{
- sprintf(CS cp2, "%.2x ", *cp1++);
- cp2 += 3;
+ cp2 += sprintf(CS cp2, "%.2x ", *cp1++);
len--;
}
cp2[-1] = '\0';