Fix uid parsing for ldap keyserver
* src/engine-gpg.c (gpg_keylist_preprocess): Check field count for uid and add fallback. -- This fixes accessing unintialized memory and resulting crashes in gpgrt_asprintf. GnuPG-Bug-Id: T3550
This commit is contained in:
parent
f430165007
commit
651b3d8207
@ -2594,6 +2594,9 @@ gpg_keylist_preprocess (char *line, char **r_line)
|
|||||||
as defined in 5.2. Machine Readable Indexes of the OpenPGP
|
as defined in 5.2. Machine Readable Indexes of the OpenPGP
|
||||||
HTTP Keyserver Protocol (draft).
|
HTTP Keyserver Protocol (draft).
|
||||||
|
|
||||||
|
For an ldap keyserver the format is:
|
||||||
|
uid:<escaped uid string>
|
||||||
|
|
||||||
We want:
|
We want:
|
||||||
uid:o<flags>::::<creatdate>:<expdate>:::<c-coded uid>:
|
uid:o<flags>::::<creatdate>:<expdate>:::<c-coded uid>:
|
||||||
*/
|
*/
|
||||||
@ -2635,9 +2638,17 @@ gpg_keylist_preprocess (char *line, char **r_line)
|
|||||||
}
|
}
|
||||||
*dst = '\0';
|
*dst = '\0';
|
||||||
|
|
||||||
if (gpgrt_asprintf (r_line, "uid:o%s::::%s:%s:::%s:",
|
if (fields < 4)
|
||||||
field[4], field[2], field[3], uid) < 0)
|
{
|
||||||
return gpg_error_from_syserror ();
|
if (gpgrt_asprintf (r_line, "uid:o::::::::%s:", uid) < 0)
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (gpgrt_asprintf (r_line, "uid:o%s::::%s:%s:::%s:",
|
||||||
|
field[4], field[2], field[3], uid) < 0)
|
||||||
|
return gpg_error_from_syserror ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user