aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2014-06-25 18:25:28 +0000
committerWerner Koch <[email protected]>2014-06-30 14:31:21 +0000
commitaa5b4392aac99382d96be94782ae745e0a42484a (patch)
treeda8e381d059dba69e65ecce3dfac2c56a51a292b
parentgpg: Rearrange code in gen_revoke. (diff)
downloadgnupg-aa5b4392aac99382d96be94782ae745e0a42484a.tar.gz
gnupg-aa5b4392aac99382d96be94782ae745e0a42484a.zip
estream: Fix minor glitch in "%.*s" format.
* common/estream-printf.c (pr_string): Take care of non-nul terminated strings.
-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