Skip to content

Commit

Permalink
Fix free space calculation.
Browse files Browse the repository at this point in the history
Improper computing of the available buffer space lead to false errors in writing down the dialog HASH and ID (only when using the D flag - dialog ID in contact username)
  • Loading branch information
bogdan-iancu committed May 16, 2017
1 parent d22f763 commit 43764b6
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions modules/topology_hiding/topo_hiding_logic.c
Expand Up @@ -465,15 +465,19 @@ static int topo_dlg_replace_contact(struct sip_msg* msg, struct dlg_cell* dlg)
/* add '.' */
*(p++) = DLG_SEPARATOR;
/* add hash entry as hexa */
n = RR_DLG_PARAM_SIZE - (p-prefix);
if (int2reverse_hex( &p, &n, dlg->h_entry)==-1)
n = (prefix_len-1)/*len without @*/ - (p-prefix);
if (int2reverse_hex( &p, &n, dlg->h_entry)==-1) {
LM_ERR("int2reverse_hex on entry failed with buf size %d\n",n);
return -1;
}
/* add '.' */
*(p++) = DLG_SEPARATOR;
/* add hash entry as hexa */
n = RR_DLG_PARAM_SIZE - (p-prefix);
if (int2reverse_hex( &p, &n, dlg->h_id)==-1)
n = (prefix_len-1)/*len without @*/ - (p-prefix);
if (int2reverse_hex( &p, &n, dlg->h_id)==-1) {
LM_ERR("int2reverse_hex on id failed with buf size %d\n",n);
return -1;
}
}
if (p!=prefix+5)
*(p++) = '@';
Expand Down

0 comments on commit 43764b6

Please sign in to comment.