mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
gpg: Fix format_keyid.
* g10/keyid.c (format_keyid): Allocate buffer earlier. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org> (cherry picked from commit a9be9f4e6e6d451698afa3d4780a53ed3718b30b)
This commit is contained in:
parent
7d8564cf88
commit
dccc471de4
@ -326,11 +326,12 @@ keyid_copy (u32 *dest, const u32 *src)
|
||||
char *
|
||||
format_keyid (u32 *keyid, int format, char *buffer, int len)
|
||||
{
|
||||
char tmp[KEYID_STR_SIZE];
|
||||
if (! buffer)
|
||||
{
|
||||
buffer = tmp;
|
||||
len = sizeof (tmp);
|
||||
len = KEYID_STR_SIZE;
|
||||
buffer = xtrymalloc (len);
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (format == KF_DEFAULT)
|
||||
@ -365,8 +366,6 @@ format_keyid (u32 *keyid, int format, char *buffer, int len)
|
||||
BUG();
|
||||
}
|
||||
|
||||
if (buffer == tmp)
|
||||
return xstrdup (buffer);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user