Skip to content

Commit

Permalink
dialog: keep route block index as signed int
Browse files Browse the repository at this point in the history
- otherwise it can be broken value when route block doesn't exit and
kemi callback should be executed
- reported by David Escartin

(cherry picked from commit 6c557ef)
  • Loading branch information
miconda authored and henningw committed May 13, 2020
1 parent 0b33f3b commit a18f9ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/modules/dialog/dlg_hash.h
Expand Up @@ -114,7 +114,7 @@ typedef struct dlg_cell
unsigned int dflags; /*!< internal dialog memory flags */
unsigned int iflags; /*!< internal dialog persistent flags */
unsigned int sflags; /*!< script dialog persistent flags */
unsigned int toroute; /*!< index of route that is executed on timeout */
int toroute; /*!< index of route that is executed on timeout */
str toroute_name; /*!< name of route that is executed on timeout */
unsigned int from_rr_nb; /*!< information from record routing */
struct dlg_tl tl; /*!< dialog timer list */
Expand Down
11 changes: 7 additions & 4 deletions src/modules/dialog/dlg_var.c
Expand Up @@ -478,8 +478,8 @@ int pv_get_dlg_ctx(struct sip_msg *msg, pv_param_t *param,
return pv_get_uintval(msg, param, res,
(unsigned int)_dlg_ctx.dir);
case 7:
return pv_get_uintval(msg, param, res,
(unsigned int)_dlg_ctx.to_route);
return pv_get_sintval(msg, param, res,
_dlg_ctx.to_route);
default:
return pv_get_uintval(msg, param, res,
(unsigned int)_dlg_ctx.on);
Expand Down Expand Up @@ -601,6 +601,7 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
int res_type = 0;
str sv = { 0 };
unsigned int ui = 0;
int si = 0;

if(param==NULL)
return -1;
Expand Down Expand Up @@ -683,8 +684,8 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
sv.s[sv.len] = '\0';
break;
case 9:
res_type = 1;
ui = (unsigned int)dlg->toroute;
res_type = 3;
si = dlg->toroute;
break;
case 10:
if(dlg->cseq[DLG_CALLEE_LEG].s==NULL
Expand Down Expand Up @@ -817,6 +818,8 @@ int pv_get_dlg(struct sip_msg *msg, pv_param_t *param,
return pv_get_uintval(msg, param, res, ui);
case 2:
return pv_get_strval(msg, param, res, &sv);
case 3:
return pv_get_sintval(msg, param, res, si);
default:
return pv_get_null(msg, param, res);
}
Expand Down

0 comments on commit a18f9ae

Please sign in to comment.