estream: Fix minor glitch in "%.*s" format.

* common/estream-printf.c (pr_string): Take care of non-nul terminated
strings.
This commit is contained in:
Werner Koch 2014-06-25 20:25:28 +02:00
parent 3a01b22071
commit aa5b4392aa
1 changed files with 3 additions and 1 deletions

View File

@ -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