diff options
author | Werner Koch <[email protected]> | 2007-05-15 16:10:48 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2007-05-15 16:10:48 +0000 |
commit | 5f3bca96826fbaf9c4469a7eedef9294f4d74bfb (patch) | |
tree | dae425970a8c0dd0f77ab62c91b2700dfbaa811e /agent | |
parent | Preparing 2.0.4 (diff) | |
download | gnupg-5f3bca96826fbaf9c4469a7eedef9294f4d74bfb.tar.gz gnupg-5f3bca96826fbaf9c4469a7eedef9294f4d74bfb.zip |
Use estream_asprintf instead of the GNU asprintf.
Diffstat (limited to 'agent')
-rw-r--r-- | agent/ChangeLog | 4 | ||||
-rw-r--r-- | agent/protect.c | 16 |
2 files changed, 11 insertions, 9 deletions
diff --git a/agent/ChangeLog b/agent/ChangeLog index 5d1ce5d52..ce8b874b1 100644 --- a/agent/ChangeLog +++ b/agent/ChangeLog @@ -1,3 +1,7 @@ +2007-05-14 Werner Koch <[email protected]> + + * protect.c (make_shadow_info): Replace sprintf by smklen. + 2007-04-20 Werner Koch <[email protected]> * gpg-agent.c (my_gcry_logger, my_gcry_outofcore_handler): Removed. 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; |