Gitweb:
https://git.exim.org/exim.git/commitdiff/49dc12554e8abfa11b764da14c65b93c545b6243
Commit: 49dc12554e8abfa11b764da14c65b93c545b6243
Parent: 6f3d774993c37967d5ad236691a194a40cc9da3f
Author: Jeremy Harris <jgh146exb@???>
AuthorDate: Mon Jul 29 17:28:13 2024 +0100
Committer: Jeremy Harris <jgh146exb@???>
CommitDate: Mon Jul 29 21:00:52 2024 +0100
Debug: support printing strings with embedded NULs
---
src/src/string.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/src/string.c b/src/src/string.c
index 5583d93de..1ac837abe 100644
--- a/src/src/string.c
+++ b/src/src/string.c
@@ -1630,13 +1630,14 @@ while (*fp)
{
gstring * zg = NULL;
int p = precision;
- for ( ; *s; s++)
- {
- /* Take a given precision as applying to the input; expand
- it for the transformed result */
- if (p >= 0 && --p < 0) break;
- switch (*s)
+ /* If a precision was given, we can handle embedded NULs. Take it as
+ applying to the input and expand it for the transformed result */
+
+ for ( ; precision >= 0 || *s; s++)
+ if (p >= 0 && --p < 0)
+ break;
+ else switch (*s)
{
case ' ':
zg = string_catn(zg, CUS UTF8_LIGHT_SHADE, 3);
@@ -1658,7 +1659,6 @@ while (*fp)
zg = string_catn(zg, CUS s, 1);
break;
}
- }
if (zg) { s = CS zg->s; slen = gstring_length(zg); }
else { s = ""; slen = 0; }
}
--
## subscription configuration (requires account):
##
https://lists.exim.org/mailman3/postorius/lists/exim-cvs.lists.exim.org/
## unsubscribe (doesn't require an account):
## exim-cvs-unsubscribe@???
## Exim details at
http://www.exim.org/
## Please use the Wiki with this list -
http://wiki.exim.org/