diff options
author | Werner Koch <wk@gnupg.org> | 2007-05-15 18:10:48 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2007-05-15 18:10:48 +0200 |
commit | 5f3bca96826fbaf9c4469a7eedef9294f4d74bfb (patch) | |
tree | dae425970a8c0dd0f77ab62c91b2700dfbaa811e /agent/protect.c | |
parent | Preparing 2.0.4 (diff) | |
download | gnupg2-5f3bca96826fbaf9c4469a7eedef9294f4d74bfb.tar.xz gnupg2-5f3bca96826fbaf9c4469a7eedef9294f4d74bfb.zip |
Use estream_asprintf instead of the GNU asprintf.
Diffstat (limited to 'agent/protect.c')
-rw-r--r-- | agent/protect.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/agent/protect.c b/agent/protect.c index 2bb38f316..ee1b5ec2b 100644 --- a/agent/protect.c +++ b/agent/protect.c @@ -1,6 +1,6 @@ /* protect.c - Un/Protect a secret key * Copyright (C) 1998, 1999, 2000, 2001, 2002, - * 2003 Free Software Foundation, Inc. + * 2003, 2007 Free Software Foundation, Inc. * * This file is part of GnuPG. * @@ -846,23 +846,21 @@ make_shadow_info (const char *serialno, const char *idstring) { const char *s; char *info, *p; - char numbuf[21]; - int n; + char numbuf[20]; + size_t n; for (s=serialno, n=0; *s && s[1]; s += 2) n++; - info = p = xtrymalloc (1 + 21 + n - + 21 + strlen (idstring) + 1 + 1); + info = p = xtrymalloc (1 + sizeof numbuf + n + + sizeof numbuf + strlen (idstring) + 1 + 1); if (!info) return NULL; *p++ = '('; - sprintf (numbuf, "%d:", n); - p = stpcpy (p, numbuf); + p = stpcpy (p, smklen (numbuf, sizeof numbuf, n, NULL)); for (s=serialno; *s && s[1]; s += 2) *(unsigned char *)p++ = xtoi_2 (s); - sprintf (numbuf, "%u:", (unsigned int)strlen (idstring)); - p = stpcpy (p, numbuf); + p = stpcpy (p, smklen (numbuf, sizeof numbuf, strlen (idstring), NULL)); p = stpcpy (p, idstring); *p++ = ')'; *p = 0; |