mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
gpg: Fix format_keyid when dynamically allocating the buffer.
* g10/keyid.c (format_keyid): Return a char *, not a const char *. If BUFFER is NULL, then set LEN to the static buffer's size. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>
This commit is contained in:
parent
ad43dc6cfc
commit
c0268c449d
@ -399,7 +399,7 @@ char *pubkey_string (PKT_public_key *pk, char *buffer, size_t bufsize);
|
|||||||
#define PUBKEY_STRING_SIZE 32
|
#define PUBKEY_STRING_SIZE 32
|
||||||
u32 v3_keyid (gcry_mpi_t a, u32 *ki);
|
u32 v3_keyid (gcry_mpi_t a, u32 *ki);
|
||||||
void hash_public_key( gcry_md_hd_t md, PKT_public_key *pk );
|
void hash_public_key( gcry_md_hd_t md, PKT_public_key *pk );
|
||||||
const char *format_keyid (u32 *keyid, int format, char *buffer, int len);
|
char *format_keyid (u32 *keyid, int format, char *buffer, int len);
|
||||||
size_t keystrlen(void);
|
size_t keystrlen(void);
|
||||||
const char *keystr(u32 *keyid);
|
const char *keystr(u32 *keyid);
|
||||||
const char *keystr_with_sub (u32 *main_kid, u32 *sub_kid);
|
const char *keystr_with_sub (u32 *main_kid, u32 *sub_kid);
|
||||||
|
@ -274,12 +274,15 @@ v3_keyid (gcry_mpi_t a, u32 *ki)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
char *
|
||||||
format_keyid (u32 *keyid, int format, char *buffer, int len)
|
format_keyid (u32 *keyid, int format, char *buffer, int len)
|
||||||
{
|
{
|
||||||
char tmp[KEYID_STR_SIZE];
|
char tmp[KEYID_STR_SIZE];
|
||||||
if (! buffer)
|
if (! buffer)
|
||||||
|
{
|
||||||
buffer = tmp;
|
buffer = tmp;
|
||||||
|
len = sizeof (tmp);
|
||||||
|
}
|
||||||
|
|
||||||
if (format == KF_DEFAULT)
|
if (format == KF_DEFAULT)
|
||||||
format = opt.keyid_format;
|
format = opt.keyid_format;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user