mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-11 02:38:09 +09:00
libssh/keyfiles.c: Fix bug when reading private keys with libgcrypt
git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@73 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
@@ -134,15 +134,16 @@ int asn1_check_sequence(BUFFER *buffer)
|
|||||||
unsigned char *j;
|
unsigned char *j;
|
||||||
int i;
|
int i;
|
||||||
u32 size;
|
u32 size;
|
||||||
|
u32 padding;
|
||||||
|
|
||||||
if (!buffer_get_data(buffer,&tmp,1) || tmp != ASN1_SEQUENCE)
|
if (!buffer_get_data(buffer,&tmp,1) || tmp != ASN1_SEQUENCE)
|
||||||
return 0;
|
return 0;
|
||||||
size=asn1_get_len(buffer);
|
size=asn1_get_len(buffer);
|
||||||
if (size != buffer_get_len(buffer) - buffer->pos)
|
if ((padding = buffer_get_len(buffer) - buffer->pos - size) > 0)
|
||||||
for (i = buffer_get_len(buffer) - buffer->pos - size,
|
for (i = buffer_get_len(buffer) - buffer->pos - size,
|
||||||
j = buffer_get(buffer) + size + buffer->pos; i; i--, j++)
|
j = buffer_get(buffer) + size + buffer->pos; i; i--, j++)
|
||||||
{
|
{
|
||||||
if (*j != 1) /* padding is allowed */
|
if (*j != padding) /* padding is allowed */
|
||||||
return 0; /* but nothing else */
|
return 0; /* but nothing else */
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user