Fix for non constructed number component
git-svn-id: https://origsvn.digium.com/svn/libpri/trunk@240 2fbb986a-6c06-0410-b554-c9c1f0a7f128
This commit is contained in:
parent
25cb0b7457
commit
badbe8cf1f
@ -231,6 +231,26 @@ int asn1_string_encode(unsigned char asn1_type, void *data, int len, int max_len
|
||||
return 2 + src_len;
|
||||
}
|
||||
|
||||
int asn1_copy_string(char * buf, int buflen, struct rose_component *comp)
|
||||
{
|
||||
int res;
|
||||
int datalen;
|
||||
|
||||
if ((comp->len > buflen) && (comp->len != ASN1_LEN_INDEF))
|
||||
return -1;
|
||||
|
||||
if (comp->len == ASN1_LEN_INDEF) {
|
||||
datalen = strlen(comp->data);
|
||||
res = datalen + 2;
|
||||
} else
|
||||
res = datalen = comp->len;
|
||||
|
||||
memcpy(buf, comp->data, datalen);
|
||||
buf[datalen] = 0;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
static int rose_number_digits_decode(struct pri *pri, q931_call *call, unsigned char *data, int len, struct addressingdataelements_presentednumberunscreened *value)
|
||||
{
|
||||
int i = 0;
|
||||
@ -309,6 +329,13 @@ static int rose_address_decode(struct pri *pri, q931_call *call, unsigned char *
|
||||
value->npi = PRI_NPI_UNKNOWN;
|
||||
value->ton = PRI_TON_UNKNOWN;
|
||||
break;
|
||||
case (ASN1_CONTEXT_SPECIFIC | ASN1_TAG_0): /* [0] unknownPartyNumber */
|
||||
res = asn1_copy_string(value->partyaddress, sizeof(value->partyaddress), comp);
|
||||
if (res < 0)
|
||||
return -1;
|
||||
value->npi = PRI_NPI_UNKNOWN;
|
||||
value->ton = PRI_TON_UNKNOWN;
|
||||
break;
|
||||
case (ASN1_CONTEXT_SPECIFIC | ASN1_CONSTRUCTOR | ASN1_TAG_1): /* [1] publicPartyNumber */
|
||||
res = rose_public_party_number_decode(pri, call, comp->data, comp->len, value);
|
||||
if (res < 0)
|
||||
|
@ -232,6 +232,8 @@ struct rose_component {
|
||||
/* Decoder for the invoke part of a ROSE request */
|
||||
extern int rose_invoke_decode(struct pri *pri, struct q931_call *call, unsigned char *data, int len);
|
||||
|
||||
extern int asn1_copy_string(char * buf, int buflen, struct rose_component *comp);
|
||||
|
||||
extern int asn1_string_encode(unsigned char asn1_type, void *data, int len, int max_len, void *src, int src_len);
|
||||
|
||||
/* Get Name types from ASN.1 */
|
||||
|
Loading…
Reference in New Issue
Block a user