res_pjsip_header_funcs.c: Check URI parameter length before copying.

Fixes #477

(cherry picked from commit 002d6c2108)
This commit is contained in:
Sean Bright 2023-12-04 09:33:26 -05:00 committed by Asterisk Development Team
parent 1c617f9b01
commit fb289b0bad
1 changed files with 4 additions and 2 deletions

View File

@ -1098,8 +1098,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;
}