mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
gpg: Replace two sprintf calls.
* g10/keygen.c (print_status_key_created): Use snprintf for now. (ask_expire_interval): Replace xmalloc and sprintf by xasprintf. -- Future updates: Replace code like r = xcalloc (1, sizeof *r + 20 ); r->key = pKEYLENGTH; sprintf( r->u.value, "%u", info.key_attr[0].nbits); by something like r = new_r_with_value ("%u", info.key_attr[0].nbits); r->key = pKEYLENGTH; Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
8c40b3b98d
commit
9d6146d6f9
11
g10/keygen.c
11
g10/keygen.c
@ -180,8 +180,9 @@ print_status_key_created (int letter, PKT_public_key *pk, const char *handle)
|
|||||||
*p++ = ' ';
|
*p++ = ' ';
|
||||||
fingerprint_from_pk (pk, array, &n);
|
fingerprint_from_pk (pk, array, &n);
|
||||||
s = array;
|
s = array;
|
||||||
|
/* Fixme: Use bin2hex */
|
||||||
for (i=0; i < n ; i++, s++, p += 2)
|
for (i=0; i < n ; i++, s++, p += 2)
|
||||||
sprintf (p, "%02X", *s);
|
snprintf (p, 3, "%02X", *s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*handle)
|
if (*handle)
|
||||||
@ -2428,13 +2429,7 @@ ask_expire_interval(int object,const char *def_expire)
|
|||||||
{
|
{
|
||||||
char *prompt;
|
char *prompt;
|
||||||
|
|
||||||
#define PROMPTSTRING _("Signature is valid for? (%s) ")
|
prompt = xasprintf (_("Signature is valid for? (%s) "), def_expire);
|
||||||
/* This will actually end up larger than necessary because
|
|
||||||
of the 2 bytes for '%s' */
|
|
||||||
prompt=xmalloc(strlen(PROMPTSTRING)+strlen(def_expire)+1);
|
|
||||||
sprintf(prompt,PROMPTSTRING,def_expire);
|
|
||||||
#undef PROMPTSTRING
|
|
||||||
|
|
||||||
answer = cpr_get("siggen.valid",prompt);
|
answer = cpr_get("siggen.valid",prompt);
|
||||||
xfree(prompt);
|
xfree(prompt);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user