File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1167,6 +1167,7 @@ int do_action(struct action* a, struct sip_msg* msg)
1167
1167
1168
1168
static int for_each_handler (struct sip_msg * msg , struct action * a )
1169
1169
{
1170
+ struct sip_msg * msg_src = msg ;
1170
1171
pv_spec_p iter , spec ;
1171
1172
pv_param_t pvp ;
1172
1173
pv_value_t val ;
@@ -1189,6 +1190,13 @@ static int for_each_handler(struct sip_msg *msg, struct action *a)
1189
1190
memset (& pvp , 0 , sizeof pvp );
1190
1191
pvp .pvi .type = PV_IDX_INT ;
1191
1192
pvp .pvn = spec -> pvp .pvn ;
1193
+ if (spec -> pvc && spec -> pvc -> contextf ) {
1194
+ msg_src = spec -> pvc -> contextf (msg );
1195
+ if (!msg_src || msg_src == FAKED_REPLY ) {
1196
+ LM_BUG ("Invalid pv context message: %p\n" , msg_src );
1197
+ return E_BUG ;
1198
+ }
1199
+ }
1192
1200
1193
1201
/*
1194
1202
* for $json iterators, better to assume script writer
@@ -1199,7 +1207,7 @@ static int for_each_handler(struct sip_msg *msg, struct action *a)
1199
1207
op = COLONEQ_T ;
1200
1208
1201
1209
for (;;) {
1202
- if (spec -> getf (msg , & pvp , & val ) != 0 ) {
1210
+ if (spec -> getf (msg_src , & pvp , & val ) != 0 ) {
1203
1211
LM_ERR ("failed to get spec value\n" );
1204
1212
return E_BUG ;
1205
1213
}
You can’t perform that action at this time.
0 commit comments