Skip to content

Commit 303fb58

Browse files
committed
imc: reject oversized unknown command replies
(cherry picked from commit 07d54db)
1 parent 2fae6df commit 303fb58

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

modules/imc/imc_cmd.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,12 +1037,16 @@ int imc_handle_unknown(struct sip_msg* msg, imc_cmd_t *cmd, str *src, str *dst)
10371037
body.len = snprintf(body.s, IMC_BUF_SIZE,
10381038
"invalid command '%.*s' - send ''%.*shelp' for details",
10391039
cmd->name.len, cmd->name.s, imc_cmd_start_str.len, imc_cmd_start_str.s);
1040-
1041-
if(body.len<=0)
1040+
if(body.len <= 0)
10421041
{
10431042
LM_ERR("unable to print message\n");
10441043
return -1;
10451044
}
1045+
if(body.len >= IMC_BUF_SIZE)
1046+
{
1047+
LM_ERR("buffer size overflow\n");
1048+
return -1;
1049+
}
10461050

10471051
LM_DBG("to: [%.*s] from: [%.*s]\n", src->len, src->s, dst->len, dst->s);
10481052
tmb.t_request(&imc_msg_type, /* Request method */

0 commit comments

Comments
 (0)