git://git.exim.org
/
exim.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
6f3d774
)
Debug: support printing strings with embedded NULs
author
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 29 Jul 2024 16:28:13 +0000
(17:28 +0100)
committer
Jeremy Harris
<jgh146exb@wizmail.org>
Mon, 29 Jul 2024 20:00:52 +0000
(21:00 +0100)
src/src/string.c
patch
|
blob
|
history
diff --git
a/src/src/string.c
b/src/src/string.c
index 5583d93de8714117d2965db806f361a6a3115294..1ac837abeceded4986878cec3ae50fff5e3e11f7 100644
(file)
--- a/
src/src/string.c
+++ b/
src/src/string.c
@@
-1630,13
+1630,14
@@
while (*fp)
{
gstring * zg = NULL;
int p = precision;
{
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);
{
case ' ':
zg = string_catn(zg, CUS UTF8_LIGHT_SHADE, 3);
@@
-1658,7
+1659,6
@@
while (*fp)
zg = string_catn(zg, CUS s, 1);
break;
}
zg = string_catn(zg, CUS s, 1);
break;
}
- }
if (zg) { s = CS zg->s; slen = gstring_length(zg); }
else { s = ""; slen = 0; }
}
if (zg) { s = CS zg->s; slen = gstring_length(zg); }
else { s = ""; slen = 0; }
}