res_pjsip_header_funcs.c: Check URI parameter length before copying.

Fixes #477
This commit is contained in:
Sean Bright 2023-12-04 09:33:26 -05:00 committed by asterisk-org-access-app[bot]
parent 8c3ebf9747
commit 8d87d403bc
1 changed files with 4 additions and 2 deletions

View File

@ -1097,8 +1097,10 @@ static int read_param(void *obj)
ast_debug(2, "Successfully read %s parameter %s (length %zu)\n",
data->paramtype == PARAMETER_URI ? "URI" : "header", data->param_name, param_len);
ast_copy_string(data->buf, pj_strbuf(&param->value), data->len);
data->buf[pj_strlen(&param->value)] = '\0';
if (param_len) {
ast_copy_string(data->buf, pj_strbuf(&param->value), data->len);
}
data->buf[param_len] = '\0';
return 0;
}