libfreerdp-core: fix padding when reading public key from X.509 certificate

This commit is contained in:
Marc-André Moreau 2011-07-13 15:10:43 -04:00
parent d19f0d1584
commit 48344cf4f7
1 changed files with 14 additions and 0 deletions

View File

@ -168,6 +168,20 @@ void certificate_read_x509_certificate(CERT_BLOB* cert, CERT_INFO* info)
ber_read_sequence_of_tag(s, &length); /* SEQUENCE */
ber_read_integer_length(s, &modulus_length); /* modulus (INTEGER) */
/* skip zero padding, if any */
do
{
stream_peek_uint8(s, padding);
if (padding == 0)
{
stream_seek(s, 1);
modulus_length--;
}
}
while (padding == 0);
freerdp_blob_alloc(&info->modulus, modulus_length);
stream_read(s, info->modulus.data, modulus_length);