urtho commented on this pull request.
- ai = (async_ms_item_t *) ((char *)at + sizeof(async_task_t) + sizeof(async_task_param_t));
+ ai->at = at; + + if(cbname && cbname->len>=ASYNC_CBNAME_SIZE-1) { + LM_ERR("callback name is too long: %.*s\n", cbname->len, cbname->s); + return -1; + } + + t = tmb.t_gett(); + if(t == NULL || t == T_UNDEFINED) { + if(tmb.t_newtran(msg) < 0) { + LM_ERR("cannot create the transaction\n"); + return -1; + } + t = tmb.t_gett(); + if(t == NULL || t == T_UNDEFINED) {
The allocation is done too early. Moving it past all the input and transaction validation.