aboutsummaryrefslogtreecommitdiffstats
path: root/common/estream-printf.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/estream-printf.c')
-rw-r--r--common/estream-printf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/common/estream-printf.c b/common/estream-printf.c
index 11e6d75fe..c03f70e3f 100644
--- a/common/estream-printf.c
+++ b/common/estream-printf.c
@@ -1209,7 +1209,9 @@ pr_string (estream_printf_out_t outfnc, void *outfncarg,
string = "(null)";
if (arg->precision >= 0)
{
- for (n=0,s=string; *s && n < arg->precision; s++)
+ /* Test for nul after N so that we can pass a non-nul terminated
+ string. */
+ for (n=0,s=string; n < arg->precision && *s; s++)
n++;
}
else