version 1.4, 2018/06/27 20:38:10 |
version 1.5, 2018/06/29 15:18:03 |
|
|
goto fail; |
goto fail; |
ber = parent[level--]; |
ber = parent[level--]; |
ret++; |
ret++; |
continue; |
break; |
default: |
default: |
goto fail; |
goto fail; |
} |
} |
|
|
} |
} |
|
|
void |
void |
|
ber_free_element(struct ber_element *root) |
|
{ |
|
if (root->be_sub && (root->be_encoding == BER_TYPE_SEQUENCE || |
|
root->be_encoding == BER_TYPE_SET)) |
|
ber_free_elements(root->be_sub); |
|
if (root->be_free && (root->be_encoding == BER_TYPE_OCTETSTRING || |
|
root->be_encoding == BER_TYPE_BITSTRING || |
|
root->be_encoding == BER_TYPE_OBJECT)) |
|
free(root->be_val); |
|
free(root); |
|
} |
|
|
|
void |
ber_free_elements(struct ber_element *root) |
ber_free_elements(struct ber_element *root) |
{ |
{ |
if (root->be_sub && (root->be_encoding == BER_TYPE_SEQUENCE || |
if (root->be_sub && (root->be_encoding == BER_TYPE_SEQUENCE || |
|
|
return 1; |
return 1; |
} |
} |
|
|
|
if (u == 0x80) { |
|
/* Indefinite length not supported. */ |
|
errno = EINVAL; |
|
return -1; |
|
} |
|
|
n = u & ~BER_TAG_MORE; |
n = u & ~BER_TAG_MORE; |
if (sizeof(ssize_t) < n) { |
if (sizeof(ssize_t) < n) { |
errno = ERANGE; |
errno = ERANGE; |
|
|
if (s < 0) { |
if (s < 0) { |
/* overflow */ |
/* overflow */ |
errno = ERANGE; |
errno = ERANGE; |
return -1; |
|
} |
|
|
|
if (s == 0) { |
|
/* invalid encoding */ |
|
errno = EINVAL; |
|
return -1; |
return -1; |
} |
} |
|
|