summaryrefslogtreecommitdiffstats
path: root/g10/passphrase.c
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2003-12-17 13:26:56 +0100
committerWerner Koch <wk@gnupg.org>2003-12-17 13:26:56 +0100
commit23fa5c97929a1206aaa662e2833eaec629d95c57 (patch)
tree5839ee2a1ea7224a0ae1175f4047e1a16d551da5 /g10/passphrase.c
parent* gettime.c (asctimestamp): Add a note on a non-avoidable gcc warning. (diff)
downloadgnupg2-23fa5c97929a1206aaa662e2833eaec629d95c57.tar.xz
gnupg2-23fa5c97929a1206aaa662e2833eaec629d95c57.zip
* card-util.c (print_name): Fixed bad format string usage.
(print_isoname): Ditto. * trustdb.c (check_regexp): s/exp/expr/. * keyedit.c (trustsig_prompt): Removed a "> 255" term; it is always false due to the data type. * passphrase.c (agent_get_passphrase): Use xasprintf and avoid non-literal format strings. * tdbio.c (upd_hashtable, drop_from_hashtable, lookup_hashtable): Fixed log_error format string bugs. Kudos to the now working gcc-3.3 -Wformat-nonliteral and Florian Weimer's investigations in gnupg 1.2.3.
Diffstat (limited to 'g10/passphrase.c')
-rw-r--r--g10/passphrase.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/g10/passphrase.c b/g10/passphrase.c
index ac7e71591..0db9404b9 100644
--- a/g10/passphrase.c
+++ b/g10/passphrase.c
@@ -673,32 +673,26 @@ agent_get_passphrase ( u32 *keyid, int mode, const char *tryagain_text,
const char *algo_name = gcry_pk_algo_name ( pk->pubkey_algo );
const char *timestr;
char *maink;
- const char *fmtstr;
if ( !algo_name )
algo_name = "?";
- fmtstr = _(" (main key ID %08lX)");
- maink = xmalloc ( strlen (fmtstr) + 20 );
if( keyid[2] && keyid[3] && keyid[0] != keyid[2]
&& keyid[1] != keyid[3] )
- sprintf( maink, fmtstr, (ulong)keyid[3] );
+ maink = xasprintf ( _(" (main key ID %08lX)"), (ulong)keyid[3] );
else
- *maink = 0;
+ maink = NULL;
uid = get_user_id ( keyid, &uidlen );
timestr = strtimestamp (pk->timestamp);
- fmtstr = _("You need a passphrase to unlock the"
+ atext = xasprintf (
+ _("You need a passphrase to unlock the"
" secret key for user:\n"
"\"%.*s\"\n"
- "%u-bit %s key, ID %08lX, created %s%s\n" );
- atext = xmalloc ( 100 + strlen (fmtstr)
- + uidlen + 15 + strlen(algo_name) + 8
- + strlen (timestr) + strlen (maink) );
- sprintf (atext, fmtstr,
+ "%u-bit %s key, ID %08lX, created %s%s\n" ),
uidlen, uid,
nbits_from_pk (pk), algo_name, (ulong)keyid[1], timestr,
- maink );
+ maink?maink:"" );
xfree (uid);
xfree (maink);