max_len=*der_len;
- temp=(char *) _asn1_alloca(strlen(str)+2);
+ temp= (char *) _asn1_alloca(strlen(str)+2);
if(temp==NULL) return ASN1_MEM_ALLOC_ERROR;
strcpy(temp, str);
{
node_asn *node,*p,*p2;
char temp[SIZEOF_UNSIGNED_LONG_INT*3+1];
- int counter,counter_old,len2,len3,move,max_len,max_len_old;
+ int counter,counter_old,len2,len3,tlen,move,max_len,max_len_old;
asn1_retCode ris;
unsigned char* der = ider;
case TYPE_SEQUENCE: case TYPE_SET:
if(move!=UP){
_asn1_ltostr(counter,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
if(p->down==NULL){
move=UP;
continue;
case TYPE_SEQUENCE_OF: case TYPE_SET_OF:
if(move!=UP){
_asn1_ltostr(counter,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
p=p->down;
while((type_field(p->type)==TYPE_TAG) || (type_field(p->type)==TYPE_SIZE)) p=p->right;
if(p->right){
{
node_asn *node,*p,*p2,*p3;
char temp[128];
- int counter,len2,len3,len4,move,ris;
+ int counter,len2,len3,len4,move,ris,tlen;
unsigned char class,*temp2;
unsigned int tag;
int indefinite, result;
break;
case TYPE_OBJECT_ID:
_asn1_get_objectid_der(der+counter,&len2, temp, sizeof(temp));
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+ if( tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
counter+=len2;
move=RIGHT;
break;
asn1_delete_structure(element);
return result;
}
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
counter+=len2;
move=RIGHT;
break;
counter+=len2;
if(len3>0){
_asn1_ltostr(counter+len3,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
move=DOWN;
}
else if(len3==0){
if(len3){
if(len3>0){ /* definite length method */
_asn1_ltostr(counter+len3,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
}
else { /* indefinite length method */
_asn1_set_value(p,"-1",3);
node_asn *node,*p,*p2,*p3,*nodeFound=ASN1_TYPE_EMPTY;
char temp[128],currentName[MAX_NAME_SIZE*10],*dot_p,*char_p;
int nameLen=MAX_NAME_SIZE*10-1,state;
- int counter,len2,len3,len4,move,ris;
+ int counter,len2,len3,len4,move,ris, tlen;
unsigned char class,*temp2;
unsigned int tag;
int indefinite, result;
case TYPE_OBJECT_ID:
if(state==FOUND){
_asn1_get_objectid_der(der+counter,&len2, temp, sizeof(temp));
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
if(p==nodeFound) state=EXIT;
}
return result;
}
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
if(p==nodeFound) state=EXIT;
}
counter+=len2;
if(len3>0){
_asn1_ltostr(counter+len3,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+
+ if(tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
move=DOWN;
}
else if(len3==0){
counter+=len2;
if(len3){
_asn1_ltostr(counter+len3,temp);
- _asn1_set_value(p,temp,strlen(temp)+1);
+ tlen = strlen(temp);
+
+ if (tlen > 0)
+ _asn1_set_value(p,temp,tlen+1);
p2=p->down;
while((type_field(p2->type)==TYPE_TAG) || (type_field(p2->type)==TYPE_SIZE)) p2=p2->right;
if(p2->right==NULL) _asn1_append_sequence_set(p);
{
node_asn *p,*p2,*p3,*p4,*p5;
char name_root[MAX_NAME_SIZE],name2[2*MAX_NAME_SIZE+1];
- int move;
+ int move, tlen;
if(node==NULL) return ASN1_ELEMENT_NOT_FOUND;
if(type_field(p4->type)==TYPE_CONSTANT){
p5=_asn1_add_node_only(TYPE_CONSTANT);
_asn1_set_name(p5,p4->name);
- _asn1_set_value(p5,p4->value,strlen(p4->value)+1);
+ tlen = strlen( p4->value);
+ if (tlen > 0)
+ _asn1_set_value(p5,p4->value,tlen+1);
if(p2==p){
_asn1_set_right(p5,p->down);
_asn1_set_down(p,p5);
}
p4=p4->right;
}
- _asn1_set_value(p2,name2,strlen(name2)+1);
+ tlen = strlen(name2);
+ if (tlen > 0)
+ _asn1_set_value(p2,name2,tlen+1);
}
}
move=DOWN;
_asn1_copy_structure3(node_asn *source_node)
{
node_asn *dest_node,*p_s,*p_d,*p_d_prev;
- int len,len2,move;
+ int len,len2,move, tlen;
if(source_node==NULL) return NULL;
_asn1_set_value(p_d,p_s->value,len+len2);
break;
default:
- _asn1_set_value(p_d,p_s->value,strlen(p_s->value)+1);
+ tlen = strlen(p_s->value);
+
+ if (tlen > 0)
+ _asn1_set_value(p_d,p_s->value,tlen+1);
}
}
move=DOWN;
_asn1_type_choice_config(node_asn *node)
{
node_asn *p,*p2,*p3,*p4;
- int move;
+ int move,tlen;
if(node==NULL) return ASN1_ELEMENT_NOT_FOUND;
while(p3){
if(type_field(p3->type)==TYPE_TAG){
p4=_asn1_add_node_only(p3->type);
- _asn1_set_value(p4,p3->value,strlen(p3->value)+1);
+ tlen = strlen(p3->value);
+ if (tlen > 0)
+ _asn1_set_value(p4,p3->value,tlen+1);
_asn1_set_right(p4,p2->down);
_asn1_set_down(p2,p4);
}