mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-30 16:17:02 +01:00
gpg: Fix format_keyid.
* g10/keyid.c (format_keyid): Allocate buffer earlier. -- Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
07671917e4
commit
a9be9f4e6e
@ -357,11 +357,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)
|
||||
@ -396,8 +397,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