summaryrefslogtreecommitdiff
path: root/main/pbx.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2015-09-02 14:41:10 -0300
committerJoshua Colp <jcolp@digium.com>2015-09-02 12:47:51 -0500
commitb51cf1e71225b8e368e062be4c94f97b4af70453 (patch)
treeac734f03e05cf88eda22d2593fe10f9e818c6670 /main/pbx.c
parentbeb568e51c1698951856d01ba844e528984959f9 (diff)
pbx: Fix crash when issuing "core show hints" with long pattern match.
When issuing the "core show hints" CLI command a combination of both the hint extension and context is created. This uses a fixed size buffer expecting that the extension will not exceed maximum extension length. When the extension is actually a pattern match this constraint does not hold true, and the extension may exceed the maximum extension length. In this case extra characters are written past the end of the fixed size buffer. This change makes it so the construction of the combined hint extension and context can not exceed the size of the buffer. ASTERISK-25367 #close Change-Id: Idfa1b95d0d4dc38e675be7c1de8900b3f981f499
Diffstat (limited to 'main/pbx.c')
-rw-r--r--main/pbx.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/pbx.c b/main/pbx.c
index fcf0aa64e..5e4f0a4db 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7521,7 +7521,7 @@ static char *handle_show_hints(struct ast_cli_entry *e, int cmd, struct ast_cli_
continue;
}
watchers = ao2_container_count(hint->callbacks);
- sprintf(buf, "%s@%s",
+ snprintf(buf, sizeof(buf), "%s@%s",
ast_get_extension_name(hint->exten),
ast_get_context_name(ast_get_extension_context(hint->exten)));