mirror of
https://github.com/asterisk/asterisk
synced 2026-08-07 10:32:13 -04:00
app_dtmfstore: Avoid a potential buffer overflow.
Prefer snprintf() so we can readily detect if our output was truncated. Resolves: #1421
This commit is contained in:
parent
86c3baea61
commit
61b2538e9b
1 changed files with 6 additions and 1 deletions
|
|
@ -170,7 +170,12 @@ static struct ast_frame *dtmf_store_framehook(struct ast_channel *chan,
|
|||
return f;
|
||||
}
|
||||
|
||||
sprintf(varnamesub, "${%s}", varname);
|
||||
len = snprintf(varnamesub, sizeof(varnamesub), "${%s}", varname);
|
||||
if (len >= sizeof(varnamesub)) {
|
||||
/* Not enough room, bail out */
|
||||
return f;
|
||||
}
|
||||
|
||||
pbx_substitute_variables_helper(chan, varnamesub, currentdata, 511);
|
||||
/* pbx_builtin_getvar_helper works for regular vars but not CDR vars */
|
||||
if (ast_strlen_zero(currentdata)) { /* var doesn't exist yet */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue