Add more error checks to asn1_get_int().

git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@551 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-04-18 15:06:43 +00:00
parent a58b7b93de
commit 479744b146

View File

@@ -118,19 +118,29 @@ static u32 asn1_get_len(BUFFER *buffer) {
}
static STRING *asn1_get_int(BUFFER *buffer) {
STRING *ret;
STRING *str;
unsigned char type;
u32 size;
if (!buffer_get_data(buffer,&type,1) || type != ASN1_INTEGER)
if (buffer_get_data(buffer, &type, 1) == 0 || type != ASN1_INTEGER) {
return NULL;
size=asn1_get_len(buffer);
if (!size)
}
size = asn1_get_len(buffer);
if (size == 0) {
return NULL;
ret=string_new(size);
if (!buffer_get_data(buffer,ret->string,size))
}
str = string_new(size);
if (str == NULL) {
return NULL;
return ret;
}
if (buffer_get_data(buffer, str->string, size) == 0) {
string_free(str);
return NULL;
}
return str;
}
static int asn1_check_sequence(BUFFER *buffer) {