Corrected some bugs with attribute list decoding

This commit is contained in:
Thomas Schmitt 2009-01-01 16:13:16 +00:00
parent b6e5dbf7c6
commit cd962d32b6

View File

@ -1258,9 +1258,10 @@ int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
{ {
int ret, was_non_aa= 0; int ret, was_non_aa= 0;
struct aaip_state *aaip; struct aaip_state *aaip;
size_t h_num, *h_lengths, i, new_mem; size_t h_num, *h_lengths, i, new_mem, pair_consumed= 0;
char **h_names, **h_values; char **h_names, **h_values;
*consumed= 0;
if(flag & (1 << 15)) { if(flag & (1 << 15)) {
if(*handle == NULL) if(*handle == NULL)
return(0); return(0);
@ -1327,10 +1328,11 @@ int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
ret= aaip->list_pending_pair; ret= aaip->list_pending_pair;
aaip->list_pending_pair= 0; aaip->list_pending_pair= 0;
} else { } else {
ret= aaip_decode_pair(aaip, data, num_data, consumed, ret= aaip_decode_pair(aaip, data, num_data, &pair_consumed,
aaip->name_buf, aaip->name_buf_size, &aaip->name_buf_fill, aaip->name_buf, aaip->name_buf_size, &aaip->name_buf_fill,
aaip->value_buf, aaip->value_buf_size, &aaip->value_buf_fill, aaip->value_buf, aaip->value_buf_size, &aaip->value_buf_fill,
1); 1);
*consumed+= pair_consumed;
} }
if(ret == -2) { /* insufficient result_size */ if(ret == -2) { /* insufficient result_size */
if(aaip->first_is_name) if(aaip->first_is_name)
@ -1393,6 +1395,7 @@ int aaip_decode_attrs(struct aaip_state **handle, char aa_name[2],
aaip->list_num_attrs++; aaip->list_num_attrs++;
aaip->name_buf_fill= aaip->value_buf_fill= 0; aaip->name_buf_fill= aaip->value_buf_fill= 0;
ret= aaip->list_pending_pair;
aaip->list_pending_pair= 0; aaip->list_pending_pair= 0;
if(ret == 2) if(ret == 2)