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